Skip to content

Instantly share code, notes, and snippets.

@gcusso
Created May 18, 2019 08:51
Show Gist options
  • Save gcusso/fbdec39b41b971d836cae42c147a2854 to your computer and use it in GitHub Desktop.
Save gcusso/fbdec39b41b971d836cae42c147a2854 to your computer and use it in GitHub Desktop.
Unity csharp snippets for vs Code
{
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"Debug.Log($1);",
],
"description": "Log output to console"
},
"Print variable to console": {
"prefix": "clog",
"body": [
"Debug.Log($\"{Utils.LogInfo()}$CLIPBOARD => {$CLIPBOARD}\");",
],
"description": "Log output to console"
},
"Print to console $": {
"prefix": "$log",
"body": [
"Debug.Log($\"$1\");",
],
"description": "Log output to console"
},
"Print to console $ and Log Method & Frame": {
"prefix": "$$log",
"body": [
"Debug.Log($\"{Utils.LogInfo()} $1\");",
],
"description": "Log output to console"
},
"DebugGraph": {
"prefix": "glog",
"body": [
"DebugGraph.Log(\"$1\", $2);",
],
"description": "Log output to graph"
},
"MultiDebugGraph": {
"prefix": "mlog",
"body": [
"DebugGraph.MultiLog(\"$1\", DebugGraph.GetUniqueColor(i), $2);",
],
"description": "Log output to graphs"
},
"Matrix<float>": {
"prefix": "mf",
"body": [
"Matrix<float>",
],
"description": "Matrix<float>"
},
// "Vector<float>": {
// "prefix": "_vf",
// "body": [
// "Vector<float>",
// ],
// "description": "Vector<float>"
// },
"Vector3": {
"prefix": "v",
"body": [
"Vector3",
],
"description": "Vector3"
},
"Unity Profiler Sample": {
"prefix": "_pr",
"body": [
"UnityEngine.Profiling.Profiler.BeginSample(\"$1\");",
"${TM_SELECTED_TEXT}",
"UnityEngine.Profiling.Profiler.EndSample();"
],
"description": "Surround selection for profiling"
},
"Wrap in function": {
"prefix": "_(",
"body": [
"$1(${TM_SELECTED_TEXT})",
],
"description": "Surround selection for profiling"
},
"ComponentData": {
"prefix": "cd",
"body": [
"[System.Serializable]",
"public struct $1 : IComponentData",
"{",
"\t$0",
"}",
"",
"public class $1Component : ComponentDataWrapper<$1> { }",
]
},
"OnGui ClipboardLabel": {
"prefix": "OnGuiClipLabel",
"body": [
"void OnGUI()",
"{",
"\tGUI.Label(new Rect(5, 5 + 20 * 0, 200, 20), $\"$CLIPBOARD => {$CLIPBOARD}\");",
"}",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment