You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you duplicate a GameObject in the editor, each component is cloned in GameObject.java
this.components = newArray<Component>();
for (Componentc : gameObject.components) {
this.components.add(c.clone(this));
}
However, some components do not have cloning implemented due to technical limitations or just not being implemented yet, like terrain component
@OverridepublicComponentclone(GameObjectgo) {
// Cant be cloned right nowreturnnull;
}
When duplicating a GameObject with components that cannot be cloned the editor crashes as a null component gets created and a NPE happens. We should add logic to handle when a null component is returned, either stop cloning the game object, or clone it partially without the components that could not be cloned. Adding a UI dialog in the editor would be a nice addition as well to notify when this happens.
The text was updated successfully, but these errors were encountered:
Closing this out as I have disabled the duplication button for Terrain and Water components in UI, as well as throwing an exception on cloning of Water or Terrain as cloning them is not supported.
When you duplicate a GameObject in the editor, each component is cloned in GameObject.java
However, some components do not have cloning implemented due to technical limitations or just not being implemented yet, like terrain component
When duplicating a GameObject with components that cannot be cloned the editor crashes as a null component gets created and a NPE happens. We should add logic to handle when a null component is returned, either stop cloning the game object, or clone it partially without the components that could not be cloned. Adding a UI dialog in the editor would be a nice addition as well to notify when this happens.
The text was updated successfully, but these errors were encountered: