Get the C# class of a script connected to an object.
MyClassName myClassObj = transform.gameObject.GetComponent();
if (myClassObj != null)
{
//call a function on the attached script
myClassObj.AFunctionInThatScript();
}
Get the C# class of a script connected to an object.
MyClassName myClassObj = transform.gameObject.GetComponent();
if (myClassObj != null)
{
//call a function on the attached script
myClassObj.AFunctionInThatScript();
}