Multiple Bolt Entity or an array of State-s in a single Bolt Entity on prefab ?
Hars
✭
in Photon Bolt
Hi!
I use a heavily component base system. Each of the components corresponds only for one thing. Let's say I have Health, Energy and Damage component. A GameObject with Damage coponent can do damage to any GameObject which have Health component independently of existence of any other components. Because of this system, I have a high variation in the components of the prefabs. For example i can have a prefab with only Health component, an other only with Damage and a third with Damage and Energy also, etc...
My problem is:
- If I put multiple Bolt Entity-s to the same prefab, then the second entity shows the "Pefab id not set, run the Bolt..." - error, which stays after running "Compile Assembly" button, and in runtime ( while the first entity runs fine ) this entity doesn't got Attached.
- I could create a state/prefab but then I could not inherience my component from EntityBehavour<???> because the state i use depends on the prefab...
- Or... I could create a huge state with all the component datas which I may need.. but this seem way too waste of resources...
It would be really good if I could add multiple states for a Bolt Entity or multiple BoltEntites with different states. Is there a way or any workarounds?
I use a heavily component base system. Each of the components corresponds only for one thing. Let's say I have Health, Energy and Damage component. A GameObject with Damage coponent can do damage to any GameObject which have Health component independently of existence of any other components. Because of this system, I have a high variation in the components of the prefabs. For example i can have a prefab with only Health component, an other only with Damage and a third with Damage and Energy also, etc...
My problem is:
- If I put multiple Bolt Entity-s to the same prefab, then the second entity shows the "Pefab id not set, run the Bolt..." - error, which stays after running "Compile Assembly" button, and in runtime ( while the first entity runs fine ) this entity doesn't got Attached.
- I could create a state/prefab but then I could not inherience my component from EntityBehavour<???> because the state i use depends on the prefab...
- Or... I could create a huge state with all the component datas which I may need.. but this seem way too waste of resources...
It would be really good if I could add multiple states for a Bolt Entity or multiple BoltEntites with different states. Is there a way or any workarounds?
0
Best Answer
-
You can't have multiple entities in a prefab, but you can have as many EntityBehavour/EntityEventListeners on the prefab as you want. In the advanced tutorial sample, there are separate scripts for Player controller, IK, nameplate, etc.
In terms of states you can have them inherit from others, for example you may have an "Enemy" state with transform and health, then a "Goblin" state with extra state properties. You can still only have one used by the entity however.5
Answers
-
You can't have multiple entities in a prefab, but you can have as many EntityBehavour/EntityEventListeners on the prefab as you want. In the advanced tutorial sample, there are separate scripts for Player controller, IK, nameplate, etc.
In terms of states you can have them inherit from others, for example you may have an "Enemy" state with transform and health, then a "Goblin" state with extra state properties. You can still only have one used by the entity however.5 -
Thank you! I created a State and an EntityBehaviour for each prefab. It is working but it takes a lot of extra work. It would be elegant if in a future version BoltEntities could use multiple states I think...1