MainScript.js
var CorrectOrder: String;
var ClickedOrder: String;
function ClickedTube(ID: int)
{
ClickedOrder = ClickedOrder + ID.ToString;
print(ID.ToString);
}
OtherScript.js
var myID: int;
var MainObject: MainScript;
function Awake()
{
MainObject = transform.parent.GetComponent(MainScript);
}
function OnMouseDown()
{
MainObject.ClickedTube(myID);
}
What I’m trying here is basically letting the player click on a couple of “items”, which then should send an ID number to the main script. the ClickedTube function adds it to a string.
However it seems like it does not send the actual number, or the conversion to string is wrong, as it gives me the following instead of an int value:
CompilerGenerated.__MainScript_ClickedTube$callable0$10_42__
and prints the following:
CompilerGenerated.__MainScript_ClickedTube$callable0$10_42__
UnityEngine.MonoBehaviour:print(Object)
MainScript:ClickedTube(Int32) (at Assets/Standard Assets/Scripts/PanFluteStatue/MainScript.js:11)
FluteScript:OnMouseDown() (at Assets/Standard Assets/Scripts/PanFluteStatue/FluteScript.js:10)
UnityEngine.SendMouseEvents:DoSendMouseEvents()
I wonder, what am I doing wrong?o.o
Thanks in advance!