Is there any way to make shallow copy of game object to replicate behavour like “Meepo” in dota2. If one of objects die all of them die and to update all healthbars if any gets damage?
I think this code can make shallow copy of gameobject. Please try.
UnityEditorInternal.ComponentUtility.CopyComponent(originalObject);
UnityEditorInternal.ComponentUtility.PasteComponentAsNew(targetobject);
You could use JsonUtility to serialize a component and deserialize it to another instance. It goes through the unnecessary json step, but unity claims it’s quite efficient and it just readily works. So unless you need some super efficient solution that copies stuff thousands of times a frame, try that.