- Home /
How to call a MainClass Funktion ?
Two questions:
I am writing a multiplayer based game.
All GameObject should be instantiated from in my GameController script. How i can call a funktion of a script atached to a GameObject from another GameObject for example a skript which trigger if a key is pressed in my player prefab ?
Also this should only be executed on the server so i neet to check:
if (network.isServer)
right ?
Thanks and greetings
Teiwaz
hello teiwaz, just a friendly advice. Do not start big in your games. learn the basics, practice practice and practice more then tackle the "hard" subjects, which won't be that hard after a while. Don't go all big and dream of making your perfect game. Start small...
Ok. So i am spawning the objects fine trouh my main Class. How to destroy the Objects centralizied from the server ? Did i need to write a RPC Call for this ?!
As you maybe realize i have some practice xd but thanks, that how i starded too.
Greetings
Teiwaz
Answer by fafase · Dec 27, 2013 at 03:19 PM
it looks this is related to accessing members from another script. There are hundreds if not thousands of example over this forums and google. http://unitygems.com/script-interaction1/
Your answer
![](https://koobas.hobune.stream/wayback/20220613124948im_/https://answers.unity.com/themes/thub/images/avi.jpg)