File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 269269 " }"
270270 ],
271271 "description" : " Create a Unity DOTS component baker & its authoring monobehavior class"
272+ },
273+ "Dots Create Baker w/ Dependency" : {
274+ "prefix" : " dcbd" ,
275+ "body" : [
276+ " using UnityEngine;" ,
277+ " using Unity.Entities;" ,
278+ " " ,
279+ " namespace ${1}" ,
280+ " {" ,
281+ " \t public class ${2:$TM_FILENAME_BASE} : MonoBehaviour" ,
282+ " \t {" ,
283+ " \t\t public ${3:GameObject} ${4:dataSource};" ,
284+ " \t }" ,
285+ " " ,
286+ " \t public class ${5:Component}Baker : Baker<${2:$TM_FILENAME_BASE}>" ,
287+ " \t {" ,
288+ " \t\t public override void Bake(${2:$TM_FILENAME_BASE} authoring)" ,
289+ " \t\t {" ,
290+ " \t\t\t DependsOn(authoring.${4:dataSource});" ,
291+ " \t\t\t " ,
292+ " \t\t\t if (authoring.${4:dataSource} == null) return;" ,
293+ " \t\t\t " ,
294+ " \t\t\t var entity = GetEntity(TransformUsageFlags.Dynamic);" ,
295+ " \t\t\t AddComponent(entity, new ${5:Component}" ,
296+ " \t\t\t {" ,
297+ " \t\t\t\t ${6:ComponentVariable} = authoring.${4:dataSource}.${0}" ,
298+ " \t\t\t });" ,
299+ " \t\t }" ,
300+ " \t }" ,
301+ " }"
302+ ],
303+ "description" : " Create a Unity DOTS component baker referencing another data source (i.e. mesh, gameObject, scriptable obj...)"
272304 }
273305}
You can’t perform that action at this time.
0 commit comments