I’m just trying to have the thePoints int increase by one when the OnTriggerEnter event is completed. Can someone let me know where I went wrong, or what kind of code I need?
Thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Collection : MonoBehaviour
{ public GameObject other;
public GameObject block;
public int thePoints = 0;
// Start is called before the first frame update
void Start()
{
block.SetActive(false);
}
// Update is called once per frame
void Update()
{
string scoreMessage = "Pieces = ";
print(scoreMessage);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.name == "screw")
{
thePoints++;
block.SetActive(true);
}
}
}