I am running into a very strange and annoying issue. I am not an expert, but I’m certainly not new to Unity or scripting, but I’m really at a loss for what to do here. I have tried everything and feel that I have exhausted all of my options.
I have a very simple script that has an onTriggerEnter that sets a GameObject to active. The game object is a Canvas object, that I simply want to display when the player collides with it. I am using a capsule with the mesh renderer disabled, I have a rigid body attached to the character, I have a capsule collider attached to the character. (I’ve done similar things a billion times). My object that I want to collide with has a box collider - with isTrigger checked - and I’ve made the box collider much larger than the object to give it a lot of room.
For some reason the game object will not be set to active when I interact with the object. I tried setting the canvas as the child of another object and setting that to active, and that didn’t work either. I then tried of instead of using a gameobject, using a Canvas and enabling that, to no avail. If I manually enable it via the inspector it shows up perfectly, but for some reason it will not trigger, because my collision is not working when it’s a trigger. If I remove the isTrigger form the object, it becomes solid and the player cannot walk through it. However when I have isTrigger enabled and the player walks through it nothing happens, I wrote a Debug.Log(“Collided” and that doesn’t even deploy.
What’s baffling and frustrating, is very recently I finished coding a game that had an onTriggerEnter function in first person view and that worked perfectly. I don’t see what’s wrong here.
Any suggestions?