How to: If the text is 10 then gameobject deletes?
<pre lang="C++">
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class UnityCollectItems : MonoBehaviour { public int sceneNum; public GameObject scoreText; public int thescore; public AudioSource collectSound; void OnTriggerEnter(Collider other) { collectSound.Play(); theScore += 1; scoretext.GetComponent<Text>().text = "SCORE: " + theScore; Destroy(GameObject); } public void IfScoreText() { if (scoretext) 10 then: gameObject.destroy; } }
How to: If the text is 10 then gameobject deletes
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)