Page 1 of 1

Access script methods throug other script

Posted: Tue Feb 25, 2020 4:31 pm
by Mr Argon
It is possible to access the methods of a script through other script? I mean, I have a custom script that changes some game mechanics, and it's all controlled by an object named GameController (public static class GameController).

I want to create an extension script that makes the previous script compatible with other game modes rather than versus.

Can I, for example, access GameController.SayLine() (custom method inside custom class) through another script?

Re: Access script methods throug other script

Posted: Tue Feb 25, 2020 8:17 pm
by JakSparro98
Extension scripts live in their own ecosystem, they can access common data zones like game session and local storage but methods, declared types and variables are exclusive of the script that implemented it.

Re: Access script methods throug other script

Posted: Tue Feb 25, 2020 9:05 pm
by Mr Argon
Maybe using localstorage I can access, because I don't want to make my script much longer, it actually has around 700 lines. Using another script for compatibility could be really useful

Re: Access script methods throug other script

Posted: Mon Mar 02, 2020 7:34 pm
by Gurt
You may use IGame.GetSharedStorage("someuniqueidentifier") to send values between scripts.

Re: Access script methods throug other script

Posted: Mon Mar 02, 2020 7:54 pm
by Mr Argon
That's a good idea, I'll try that out. Thanks