parametersunity-game-engineunityscripttransmission

Transmitting parameters from script to script, how?


I know there are a few answers on that question, but they don't work for me or I am only to stupid. Sorry.

Here are my scripts:

menu_options.js - http://pastebin.com/NFXD3ZgP

Transmitter.js - http://pastebin.com/kCmGTgbH

i've attached the Transmitter.js to a specific object. It's called "_Transmitter".

If I run my scripts I get following Error:

Assets/Script/menu_options.js(7,40): BCE0023: No appropriate version of 'UnityEngine.GameObject.GetComponent' for the argument list '(UnityEngine.GameObject)' was found.

Why? And what does it mean?

What did I understand wrong in the tutorials and answers?

I also tried this:

trans = Transmitter.gameObject.GetComponent(Transmitter);

and this:

trans = Transmitter.GetComponent(Transmitter);

Solution

  • PlayerPrefs.SetInt("variablenname", 1);
    

    and

    var v1 = PlayerPrefs.GetInt("variablenname");
    

    works great!