Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

Why my counting method is stucked on the beginning?

$
0
0
Hello, I hava created script to count goals, but the text is stucked on 0 even if i it should be 1 or more. Thanks for help :) private int score1; public Text score1Text; // Use this for initialization void Start() { score1 = 0; SetScore1Text(); } void OnCollisionEnter2D(Collision2D collisiongoal) { Goal1(); SetScore1Text(); score1 = score1 + 1; } void Goal1 () { Goal.gameObject.SetActive(true); GoalSound.Play(); ball.SetActive(false); ball.transform.position = destination.position; //Debug.Log("Goal!"); startgoal = true; player1.gameObject.SetActive(false); player2.gameObject.SetActive(false); respawn = true; } void SetScore1Text() { score1Text.text = score1.ToString(); } }

Viewing all articles
Browse latest Browse all 187

Trending Articles



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