I know this is kindof a simple question but… how do you make a copy constructor for a custom class in js and in cs in Unity. Thanks for all the help.
It’s the same whether you’re using unity or not.
In C#:
public Name_Of_Class(Name_Of_Class other)
{
if(other != null)
{
this.class_variable = other.class_variable;
//etc.
}
}
(Unless you want the Unity engine itself to call it…?)
Figured it out. Just use the name of the custom class. Like this:
class Name
{
Name()
{
//Add Constructor info here
}
}