Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

How do I access scripts

$
0
0
Hello I trying to access two scripts . Im try to access the MyClock Script and the ScoreManager Script from the PlayerPreference Script. I've have type in the codes I need in the PlayerPreference script , so I can access ScoreManager . I gotten an error error CS0246: The type or namespace name `scoreManager' could not be found. Are you missing a using directive or an assembly reference? I thought I had code it right . Here is the scripts : using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine; public class PlayerPreference : MonoBehaviour { private scoreManager scoreManagerScript; private MyClock MyClockScript; void Awake () { scoreManager = GetComponent(); myClock = GetComponent(); } void Update(){ if ((myClock != NULL) && (scoreManager != NULL) && (myClock.m_leftTime >= scoreManager.score)) { SceneManager.LoadScene("time"); } } } using UnityEngine; using System.Collections; using UnityEngine.UI; public class ScoreManager : MonoBehaviour { public static int score; private Text text; void Awake () { text = GetComponent (); score = 0; } void Update () { text.text = "Score :" + score; } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>