Skip to content

Commit 27cbaa1

Browse files
committed
Add dots create baker snippet
1 parent 0fc89a4 commit 27cbaa1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

snippets.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,33 @@
241241
"}"
242242
],
243243
"description": "Create a Unity DOTS Job"
244+
},
245+
"Dots Create Baker": {
246+
"prefix": "dcb",
247+
"body": [
248+
"using UnityEngine;",
249+
"using Unity.Entities;",
250+
"",
251+
"namespace ${1}",
252+
"{",
253+
"\tpublic class ${2:$TM_FILENAME_BASE} : MonoBehaviour",
254+
"\t{",
255+
"\t\tpublic ${3:float} ${4:variable};${0}",
256+
"\t}",
257+
"",
258+
"\tpublic class ${5:Component}Baker : Baker<${2:$TM_FILENAME_BASE}>",
259+
"\t{",
260+
"\t\tpublic override void Bake(${2:$TM_FILENAME_BASE} authoring)",
261+
"\t\t{",
262+
"\t\t\tvar entity = GetEntity(TransformUsageFlags.Dynamic);",
263+
"\t\t\tAddComponent(entity, new ${5:Component}",
264+
"\t\t\t{",
265+
"\t\t\t\t${6:ComponentVariable} = authoring.${4:variable}",
266+
"\t\t\t});",
267+
"\t\t}",
268+
"\t}",
269+
"}"
270+
],
271+
"description": "Create a Unity DOTS component baker & its authoring monobehavior class"
244272
}
245273
}

0 commit comments

Comments
 (0)