Search Unity

Script not showing variables in Inspector?

Discussion in 'Scripting' started by Wasser_, Nov 27, 2015.

  1. Wasser_

    Wasser_

    Joined:
    Nov 16, 2015
    Posts:
    2
    Hello everyone, I'm having some issues with a door i'd to have open/close in the latest version of Unity, I have a trigger and I have my door mesh, I'm copying this script online and on the video they have variables for the script, whereas I don't.. Any suggestions? * You'll also to forgive me, this is part of a University assignment and I'm completely new to coding, I'm normally using Unreal engine so I decided to switch it up with Unity :)


    var door : GameObject;
    var sound : AudioClip;
    var text : GameObject;

    function Start () {
    door.SetActive(true);
    text.SetActive(false);

    }

    function OnTriggerStay (col : Collider)
    {
    if(Input.GetKeyDown(KeyCode.E))
    {
    door.SetActive(false);
    AudioSource.PlayClipAtPoint(sound, transform.position);
    text.SetActive(false);

    }
    }

    function OnTriggerExit (col : Collider)
    {
    text.SetActive(false);
    }

    function OnTriggerEnter (col : Collider)
    {
    text.SetActive(true);
    }
     
    Last edited: Nov 27, 2015
  2. Wasser_

    Wasser_

    Joined:
    Nov 16, 2015
    Posts:
    2
    @martinmr
    Hey, I can't seem to reply to your comment but that isn't working either I'm afraid, I have 2 weeks to finish this project and right now anything to do with coding is giving me nightmares! :p
     
  3. martinmr

    martinmr

    Joined:
    Mar 25, 2015
    Posts:
    325
    yeah i just checked it afterwards, myself coding in c#, and every variable is private at default, in unity/javascript everything is public by default.

    only could think of that there's a compile error and therfore it's not displaying, but this you would have seen :D