I want to create clones of my behaviours (by using GameObject.Instantiate()), but sometimes they have relationship with objects that are not behaviour. In this case, Instantiate would create a game object with null references for these relationships. I can make these classes serializable and use the SerializeField attribute, but they’d show up in the editor, which would be a mess.
Is there another way to do this?
Example:
public class CloningTests : MonoBehaviour
{
[SerializeField]
private SimpleObject SimpleObject;
...
}
[Serializable()]
public class SimpleObject
{
public int number = 0;
...
}
That would work but SimpleObject would appear in the editor.