Question by
rtstudiosco · Jun 22, 2018 at 07:36 PM ·
scripting problembuild-errorscoreproject
Why is my score not adding up when the project is built
using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine;
public class Pickup : MonoBehaviour {
private int count;
public Text countText;
public Text scoreText;
// Use this for initialization
void Start () {
count = 0;
SetCountText ();
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag ("Pick Up")) {
other.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
}
}
void SetCountText () {
countText.text = "Score: " + count.ToString ();
scoreText.text = "Score: " + count.ToString ();
}
}
So I have a game where if you collide with an object it adds 1 point to your score. This works fine when I play the game in the Unity Editor, but when I build it to WebGL, it doesn't work. Please help. Thanks
Comment
Your answer
Follow this Question
Related Questions
About generated dlls and Unity 1 Answer
Build Fail - Unity 2020.3.30f1 1 Answer
Help Using Score to Load Level 1 Answer
Performance Issue on Update 1 Answer
Transform.RotateAround Obsolete Issue 0 Answers