Exactly as as the title says, I want to make my own function that I can access from any other script, I want this so I can make a function for easy creation of timers.
Not sure why you would really want to do it this way, but you can.
You can make your scripts a singleton based class.
public class FUN : Monobehaviour
{
private FUN _instance;
void Awake ()
{
_instance = this;
}
public FUN instance
{
get { return _instance; }
}
public DoSomethingAwesome()
{
}
}
This is one way of achieving this.
Now then for this to work this script needs to be attached to any object on the scene.
Then you can access it from anywhere as such …
FUN.instance.DoSomeThingAwesome();
Hope this helps.
You can also do [scriptname].function;
Don’t know if it has to be RPC though