MrGVSV / bevy_proto

Create config files for entities in Bevy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: is it possible in bevy_proto to predefine an entity reference to a child in a custom structure?

rewin123 opened this issue · comments

commented

I didn't find an example. I want to make a predefined door structure consisting of a parent (DoorProto, looks like a doorframe) and the door itself, which is a child of DoorProto. Both parent and child have their own gltf meshes. Also it is required to predefine entity in DoorProto on a door.

Have you seen the hierarchy example? Its prototype files demonstrate how to define entity relationships.

However, this only works for entities generated by the prototype. I don't know how GLTF works, but if it contains a sub-entity, then it's not currently possible to define that relationship in the prototype asset. Your best bet there would be to do one of the following:

  • Define a system to add/edit the relationship on MyComponent added
  • Or, create a custom schematic that will do the relationship work for you

The first option works okay, but if you can do the latter that would probably be the best solution.

Does that help at all?

commented

Oh, I apologize for the very late reply. Thank you, this actually answers to my question and will get rid of the redundant code
😅