How to Move Prefabs in ECS AR

This will take you about 20 minutes in prep time if you don't have Unity set-up, and 30 minutes in coding and debug time.

Click Here for DOTS Tutorial

Stop struggling with the limited documentation. Follow this step-by-step tutorial: "How to Move Prefabs in ECS AR."

Full workflows and code to programmatically add movement to prefab entities

Click Here for DOTS Tutorial

This gitbook takes you through step-by-step full workflows and code to programmatically add movement to prefab entities. Once you've coded along and fully finished the "How To Move Prefabs" tutorial, you will be able to programmatically add movement to prefab entities.

Click Here for DOTS Tutorial

High-Level steps to Move Prefabs:

Number 01

Decide on the "destroy conditions" of your entities (i.e. "destroy entities that leave the perimeter")

Number 02

Create a system that adds a Destroy tag to those prefabs that will be destroyed

Number 03

Create another system that destroys any prefabs that have a destroy tag

FAQ

What is an Entity in ECS AR?

An entity is a collection of components. Let's say there is an asteroid with a Translation component which is a float3 and denotes the asteroid's position in space. Updating the Entity's Translation component values is not a structural change. The Entity still has the same amount and types of components, just different values.

What is an Entity Prefab in ECS AR?

An entity prefab is nothing more than an entity with a Prefab tag and a LinkedEntityGroup. The former identifies the prefab and makes it invisible to all entity queries but the ones who explicitly include prefabs, and the latter links together a set of entities, since entity prefabs can be complex assemblies (equivalent to GameObject hierarchies).

What are system types in ECS AR?

SystemBase - this is the type of system used most of the time for runtime game play. The systems of this type will do things like provide movement to asteroids or Spawn/Destroy. ComponentSystemGroup - this is groupings of systems. GameObjectConversionSystem - We have interacted with these systems when working with our GameSettingsComponent and our SetGameSettingsSystem. These are used for hybrid development. EntityCommandBufferSystem -EntityCommandBufferSystems are used as "sync" points for structural changes to entities.

Haven’t begun learning Unity DOTS yet, and need to start at the very beginning?

If you haven't yet dipped your toes into learning Unity's new multithreaded Data-Oriented Technology Stack (DOTS), now is the time. You can start at the very beginning with Moetsi’s tutorial, which culminates in your very own deployable sample project. You’ll be guided by full workflows, code-alongs, videos, and GIFs along the way.

Get Started