-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Generate your first component
Simon Schmid edited this page Jun 19, 2015
·
13 revisions
Let's create our first custom component and let the Code Generator do its magic!
Open the Entitas preferences and set the Generated Folder
path where the Code Generator should save files.
Create a new class and implement IComponent
using Entitas;
public class PositionComponent : IComponent {
public float x;
public float y;
public float z;
}
Select Entitas/Generate
Have fun!
var pool = new Pool(ComponentIds.TotalComponents);
var e = pool.CreateEntity();
e.AddPosition(1f, 2f, 3f);
e.ReplacePosition(3f, 2f, 1f);
e.RemovePosition();
var posX = e.position.x;
var hasPosition = e.hasPosition;
Guides: Introduction - Installation - Upgrading - FAQ - Cookbook - Contributing
Need Help? Ask a question on Discord or create an issue.
- The Basics
- Concepts
- Architecture / Patterns