Roll-A-Ball tutorial collision/trigger problem

I am a beginner in Unity and am taking the roll-a-ball tutorial and everything was smooth but when I got to section 06 of the tutorial my pickups didn’t work. the player just passes through the cubes and they don’t disappear as they did in the tutorial video.

here is my PlayerController script

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
{

    public float speed;

    void FixedUpdate ()
    {
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

        rigidbody.AddForce (movement * speed * Time.deltaTime);
    }

    void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag == "PickUp")
        {
            other.gameObject.SetActive(false);       
        }
    }
}

P.S. I ticked Is Kinematic and Is trigger

Have you assigned the ‘PickUp’, tag to the pickup prefab after adding it to the tag list?
have a wee look and see that the tags are there in the scene on the cubes.

Yes I did and I just found the problem thanks to you, I just noticed that I spelled PickUp in the script with a small “p” at the end, but it was a capital “P” in the tag.

Thanks for the help :smile:

sorry for the late reply; had exams

1 Like

nice one :slight_smile: