Sorry to keep flooding your inbox. I finally figured it out. Code below. ================================== usin...

posted to: Interactive Buttons
Sorry to keep flooding your inbox. I finally figured it out. Code below. ================================== using UnityEngine; using UnityEngine.UI; using System.Collections; //using System; public class ExitScript : MonoBehaviour { public Text nameMe; void Start () { //nameMe = gameObject.GetComponent(); //nameMe = GetComponent(); nameMe.text = "Welcome to Scene 01"; } // Update is called once per frame void Update () { if(Input.GetKeyDown (KeyCode.Escape)) { Application.LoadLevel (0); print ("Back to Main Page"); } else if(Input.GetKeyDown (KeyCode.G)) { nameMe.text = "Howdy!"; } } } ============================================ dunno how/why GetComponent was screwing things up. Oh well. LUV what you're doing Jonathan! Big Thanks!!
  • Jonathan Gonzalez(jgonzalez) replied

    I think I know what error you’re getting, or at least I see an error still present. In later versions of Unity 5 they stopped using “Application.LoadLevel()” and now use a “SceneManager”.

    So at the very top you need to use this namespace:
    using UnityEngine.SceneManagement;

    Then to load a scene you write:
    SceneManager.LoadScene(1);

    With GetComponent you need to specify what you’re getting. I assume the "text" elements in your script above was stripped int he comment but if not I'll specify. A game object can have multiple components on them. 

    Sometimes this is not needed though as Unity will often do this for you in the background. Commonly used components will be cached for you like this in the background.

  • Arn Sweatman(gnaws999) replied
    I hate when they do that. =] Thanks for the feedback.