Call Function from another Script

Hello,

How can I call or execute a function from a Script in other script?..any help about it? :face_with_spiral_eyes:

There are two ways.
First way is if the script is attached to a game object. If it’s attached to the same gameobject

var myGameImageLib = GetComponent (“GameImage_Lib”);
myGameImageLib is the variable you’ll use to use the file called GameImage_Lib.js

To call a function from GameImage_Lib
myGameImageLib.CreateInfluenceLine();

The second way is if the file isn’t attache to anything (does not carry any information). Place the file you want to use in StandardAssets>Scripts
To use them you just use filename.functionname