I’d like to add this ability to my utility belt, but I can’t think of any good ways to make it happen. The closest I’ve been able to get is instantiating a new entity in the active scene, and then assigning it a type. However, I’d like to clone an entity in its current state including all the components. Is such a thing possible in craft 3? Thanks!
Nothing built-in by the look of it, sorry.
@arismoko Cloning isn’t possible at the moment but it is something that I’ve been working on in Codea 4, which uses a new entity component system. This is mainly to support things like prefabs, searialisation, etc…
My own entity component system wrapper is coming along fairly well, so I’m really happy to see your taking Codea in this direction! I think it’s half possible currently with just lua and some clever uses of tables, but i’d rather wait for a proper solution.
in my own system, cloning would essentially be creating a new GameObject with the same components as the other one, pulled from the data source that instantiated the original, if i needed to copy the state i would loop through the states of each component using the other GameObject as the reference and set them
I just use a table to define the template object, and then create a function to spawn and apply the variables to the spawner/emitter. This works really well for particles, but not much more than that.