I read a lot of forum threads and answers about accessing other GameObject’s scripts. In case of C# I am totally fine, but I need to write a reference into a JavaScript to access a C# script. As long as they are on the same GameObject, everything is fine. But how do you modify the following line (not being attached to “Rmenu” object) to access “Rmenu” object, “Page” script “PageNumber” public variable?
var x = GameObject.Find(“Rmenu”).GetComponent(Page).PageNumber;
I’m keep getting the error message: BCE0018: The name ‘Page’ does not denote a valid type (‘not found’).
As always any answer and hints are welcome and thanked in advance.
I can not believe I fell into the same trap as previously. Due to a similar un-accessibility I started putting my scripts into “Standard Assets” folder. As you suggested I moved my Javascript out of this folder and immediately everything was working. Reading the referenced links you sent me, I understand that in C# this is not a problem. I highly consider sticking to C# only, in spite it seems less flexible when programming. But anyway: