Closed james7132 closed 9 years ago
Can you give an example of how would the conflict happen? If you're inside a MonoBehaviour method and do: Instantiate, it should resolve to the static one unless you said this.Instantiate.
public static class Visuals
{
public static void CreateEffect(ParticleSystem effectPrefab)
{
effectPrefab.Instantiate ();
}
}
It is a nice shortcut when not working strictly in a MonoBehaviour or ScriptableObject context.
Well then, I'd use InstantiateNew (or NewInstance) instead of Copy, cause Copy implies that you have an source and you're copying to it from a destination.
Would Clone be OK? or would that be confusing with ICloneable implementers?
If not, I'll just use NewInstance.
Clone could be used as an extension method to do a serialize/deserialize to an object (deep copy) and ICloneable like you said. Just use InstantiateNew or NewInstance. I'd use the former cause it's sort of obvious what it's doing: Instantiate as opposed to NewInstance which could imply it's doing something different, just my opinion. Both are fine.
It should be to InstantiateNew now.
The Instantiate Extension functions were conflicting with the actual static methods in the UnityEngine.Object class, making calling the functions impossible.
Since the objects were already loaded in memory by the time the functions are called. I renamed them to Copy instead (since that's basically what the functions are doing at this point).