-
-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple instantiation of prefabs causes ambiguous IDs #2067
Comments
Easy to fix: do the fixup in your entity processor. What is the actual use case of instantiating prefabs from within an entity processor? I don't think it should be done this way. It's not the purpose of an entity processor in my opinion. That should be better done with a script. The purpose of an entity processor is usually to gather associated data (such as sound instance, animation system, etc.), not to instantiate more entities or prefabs. What will happen if the prefab also contains the same custom component: it might create a recursive loop, with new entities being instantiated forever. Note: I'm not saying there is no bug in this area. But I think more analysis should be done to understand the underlying issue and the consequence of any "fix". For instance, in the editor we have some flags to fixup ids when using the |
The use case is that I want to create a generic environment, based on the settings in the EntityComponent, from combined prefabs at runtime. My only known way to see this generic environment in game studio is to use an EntityProcessor. This is because, unlike ScriptComponents, it is also executed in the game studio. Or are there other options? |
Right now there aren't, no. What you're trying to do is not yet supported, the editor builds a layer on top of the scene hierarchy that abstracts away a couple of things. It doesn't really expect new entities being spawned through user-code. |
Release Type: Official Release
Version: 4.2.0.2042
Platform(s): Windows
Describe the bug
When a scene contains two or more entity components with an entity processor that instantiates the same prefab and attaches the instantiated entities to the entity of the component, then the editors crashes when changing the hierarchy.
This is caused because the instantiated entities and components got the same IDs as the corresponding elements in the prefab. When this instantiation happens multiple times, the hierarchy has different elements with the same ID that bring forth errors.
To Reproduce
Steps to reproduce the behavior:
Example implementation:
Component:
Processor:
Expected behavior
All entities and components instantiated by a prefab should get a unique ID.
Log and callstacks
The
EntityHierarchyEditorController
throws anArgumentException
here:The text was updated successfully, but these errors were encountered: