I followed the Roll A ball tutorial, and the game runs correctly in the Unity IDE. It function as described in the tutorial. However, when I build the game (Window target), the player ball would go through the pickup cubes, but the pickups would not disappear. Here is my script for the player. Could someone point me in the right direction?
Thanks,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour {
public float SpeedScale = 1;
public Text ScoreLabel;
public Text EndLabel;
private Rigidbody m_rb;
private int m_count = 0;
// Use this for initialization
void Start ()
{
m_rb = GetComponent();
m_count = 0;
EndLabel.text = “”;
UpdateScore();
}
private void UpdateScore()
{
ScoreLabel.text = "Score: " + m_count.ToString();
}
// Update is called once per frame
void Update () {
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag(“PickUp”))
{
other.gameObject.SetActive(false);
++m_count;
if (m_count == 15)
EndLabel.text = “You Win”;
UpdateScore();
}
}
private void FixedUpdate()
{
float x = Input.GetAxis(“Horizontal”);
float z = Input.GetAxis(“Vertical”);
Vector3 movement = new Vector3(x, 0, z);
m_rb.AddForce(movement * SpeedScale);
}
}