- Home /
Question by
importguru88 · Jun 23, 2016 at 04:43 PM ·
uitextscenecanvasswitch scenes
How do I switch scenes by obtain a children ui canvas text
Having an issue switching scene . I need to obtain the children. I code a line gameObject transform .
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreManagerScript : MonoBehaviour
{
public static int score;
private Text text;
void Awake()
{
text = GetComponent <Text> ();
score = 0;
DontDestroyOnLoad(transform.gameObject);
}
void Update()
{
text.text = "Score: " + score;
Debug.Log("Score: " + score);
}
}
Comment