I want to display a message in the level, like a pop-up text that shows the current location when my character has passed a trigger.
(Player enters trigger Panel & text animate in auto hide player exits can re-enter and trigger again.)
I’ve already animated both the panel and the text.
I have a 3D object (cube) with a box collider with ’ is Trigger ’ checked, and I’ve set my character to have the ’ player ’ tag.
I have screenshots of my Inspector, Hierarchy, Animator, Animation, and Script setups if that helps.
I have debug logs in the script that tell me when my player has entered and exited the trigger object, which works.
It’s the animation part that is confusing me. At one point, I got it working, but then I couldn’t trigger the animation again after re-entering the trigger collider. Then, for a while, the panel gameobject would reappear after the animation had finished. Now, nothing is appearing lol
I’ve been trying to do this for days and have spent a considerable amount of time trying to get this working…It’s so infuriating. I’ve even asked ChatGPT for assistance, and I’ve been going around in circles with the suggestions and error messages.
Enabling/disabling a game object which contains your panel/text might solve the problem. You could use the OnTriggerEnter method. If you use the Animator, make sure the states and their transitions are set up correctly, so you can control them via code.
I am in the ‘Unity 2.5D Turn-Based RPG: Build Your Own Turn-Based Battles & Environments’ course, but what I’m doing is out of the scope of the course and is not covered in the course. So im not sure if it’s allowed to be asked here.
If I disable it, the panel and text won’t appear. If I enable them, they remain on the screen from the get-go. I am using the OnTriggerEnter method too.
You may ask for help here. However, we teaching assistants usually do not have time to help with problems that are outside the scope of our courses. If nobody replies to help you, you could also ask for advice on our official Discord server.
Have you already tried to add Debug.Logs to your code to see what is going on during runtime? The first step is to enable and disable the game object in specific cases at runtime. Once this works, you can check if the animator states work as expected. If you approach this problem step by step, you will very likely be able to solve it.