Skip to content

oleghcp/vssnippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Snippets for Visual Studio

Place snippet files to the snippet folder in addition to existing ones.
For example for vs 2022 it is:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC#\Snippets\1033\Visual C#\

Common C# Snippets

Method

void MyMethod()
{
    throw new System.NotImplementedException();
}

Deconstructor

public void Deconstruct()
{

}

Yield return

yield return null;

fixed

fixed (void* ptr = value)
{

}

StructLayout

[StructLayout(LayoutKind.Sequential, Pack = 1)]

MethodImpl

[MethodImpl(MethodImplOptions.AggressiveInlining)]

For Unity

Debug.Log();

Debug.Log();

SerializeField

[SerializeField]

SerializeReference

[SerializeReference]

UnityObject

using UnityObject = UnityEngine.Object;

#if UNITY_EDITOR

#if UNITY_EDITOR

#endif

#if UNITY_EDITOR || DEVELOPMENT_BUILD

#if UNITY_EDITOR || DEVELOPMENT_BUILD

#endif

OnValidate + Reset

#if UNITY_EDITOR
    private void OnValidate()
    {
        ValidateData();
    }

    private void Reset()
    {
        ValidateData();
    }

    private void ValidateData()
    {

    }
#endif

CustomEditor

[CustomEditor(typeof(ExampleClass))]

CustomPropertyDrawer

[CustomPropertyDrawer(typeof(CustomType))]

MethodButtonsEditor

Used for InspectorButtonAttribute from https://github.com/oleghcp/UnityTools

#if UNITY_EDITOR
    [UnityEditor.CustomEditor(typeof(ExampleClass)), UnityEditor.CanEditMultipleObjects]
    private class Editor : OlegHcpEditor.MethodButtonsEditor { }
#endif

About

Snippets for Visual Studio

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published