I am VERY new to unity and have been working on learning how to use C# and navigate unity and I am currently making a game where you are a rock and you have to collect little glowing orbs to make the rock bigger. I have been following some tutorials and searching online for resources to figure out how to get the collisions to work but they aren’t working for some reason. Does anyone know how to get it to work? Here’s my code:`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GlowCollect : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter(Collision collision)
{
if (other.name == "rock")
{
Destroy(gameObject);
}
}
By the way, this code is currently supposed to be applied to the orbs you have to collect but if I should be applying this to the player (or something else entirely) that works. Also, this is the tutorial I have been following: Unity Tutorial | Coin Pickups - YouTube