I’m looking for example of how to create an entity and its components from scratch. I’ve seen endless of videos and other examples, but not a single one where the data is created from scratch, and I really don’t want to create GameObjects and/or Prefabs to convert into Entities as a middle step.
so I guess something like this would work? When not converting from a GameObject, what components do I need to get the entity drawn on screen? In examples I see mosty just having components for position and rotation.
You can create a EntityArcheType as a way of writing out all the Components that you want to have on your entity (a kind of prefab in code).
To get the object to render, you need a RenderMesh-Component, and I believe a LocalToWorld-Component (for positioning).
The RenderMesh-Component would need a mesh and a material to render, but you can load those using Resources.Load()
Translation is used as a ‘position’, but will be added to the Entities LocalToWord-Matrix by one of Unity’s Systems (I believe it’s the EndFrameTransform-System.)
You don’t really need it, because you can set the position directly to the matrix if you want to, but you can use the Translation-Component (and the Rotation- and UniformScale- ones) as well.
Just make sure you actually have a LocalToWorld that the RenderSystem can eventually read from.