Hi everyone,
As per Unity’s doc, for using SendMessage, I’m using the following scripts on two gameobjects.
//GameObjects
CubeMaster
CubeSlave
I’ve the following scripts bound on the above objects…
// on CubeMaster → scrMaster.js
// on CubeSlave —> scrSlave.js
The following code is contained in the scripts…
// scrMaster.js
function OnGUI()
{
if(GUILayout.Button(“sendMessage”))
{
gameObject.SendMessage(“makeRotation”,30.0,SendMessageOptions.DontRequireReceiver);
}
}
// scrSlave.js
function makeRotation ( val : float )
{
gameObject.transform.Rotate(Vector3.up, val );
}
Now, my problem is, my CubeSlave should rotate by 30 degrees, but its not!
Check this page for documentation of SendMessage,
and help me where am I going wrong!