public class Birb : MonoBehaviour
{
public static GameObject MakeBirbCopy( GameObject original )
{
Birb newBirb = Instantiate(original).GetComponent();
newBirb.m_canExecuteAirSpecial = false;
return newBirb.gameObject;
}
}
public class Example: MonoBehaviour
{
}
How do I get Make BirbCopy reference from Birb class to Example class?
Not exactly sure what you meant, but here:
public class Example: MonoBehaviour
{
public void RandomFunctionName()
{
Birb birbOriginal = Object.FindObjectOfType<Birb>();
Birb birbClone = Birb.MakeBirbCopy(original);
}
//Or you could do this, if you assign this value in the editor with a prefab or instance
public Birb birbPrefab;
public void RandomFunctionNameAgain()
{
Birb birbClone = Birb.MakeBirbCopy(birbPrefab);
}
}
Something like this?
public class Birb : MonoBehaviour
{
public static GameObject MakeBirbCopy( GameObject original )
{
Birb newBirb = Instantiate(original).GetComponent<Birb>();
newBirb.m_canExecuteAirSpecial = false;
return newBirb.gameObject;
}
}
public class Example: MonoBehaviour
{
Birb birb = GameObject.Find("Object_with_birb_script").GetComponent<Birb>();
birb.MakeBirbCopy(someGameObject);
}