- Home /
Acsessing a script in the project folder
Im working on a javascript that needs to acsess a function in a C# script.
The GameObject.Find dosent work as the script only is in the project folder and not in the scene. And dragging the scrpt into the variable in the inspector wont work either as this script is going to be used on several different objects, and id rather not ahve to to this for each one.
Any ideas on how i can fix this?
Answer by Mike 3 · May 07, 2010 at 02:27 PM
If the script doesn't need to be on an object, it should probably not be a monobehaviour
then you just need to worry about accessing the function
either make the function static (public static void MyFunction() {} ) and use MyClass.MyFunction() or you'll need to instantiate the class in your own code and use instance methods (e.g. var myInstance = new MyClass(); myInstance.MyFunction(); )
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
variable = true from another script 2 Answers
First person shooter shoot Function 3 Answers
running code outside of update! 3 Answers