I tried searching around for this, but I wasn't able to find an answer.
I have a gameobject with a custom component attached (C# script). This script has several variables that have been set previously (Lists, booleans, etc). I need to make a clone of it.
Now, when I Instantiate a new object from this one, I have noticed that none of the variables from the original are copied over; the component is in a fresh state in the new one.
Is there a way to perform a deep clone of a gameobject? A clone where the state of every attached component is identical to the original, including members?
EDIT:
Here is some example code to demonstrate the issue (the original code is far too verbose)
public class FooBar : Monobehaviour {
private HashSet hashSet;
public void Awake() {
hashSet = new HashSet
↧