- Home /
Help using multiple triggers with multiple scripts.
I have an audio trigger script, which plays a sound when a trigger is touched, and I have a script that loads a scene when a trigger is touched. Both scripts are placed in the FPC. But when I touch the audio trigger or scene trigger, they both play the sound and load the scene. Is there a way to use seperate triggers? Also, I'd rather not edit the audio trigger script, the scene loading trigger script is much less of a priority for me. I'm still new to Unity.
Answer by ScroodgeM · Aug 07, 2012 at 10:26 PM
best way to isolate triggers and events is to place it to empty GameObject, and this GO attach to your main GO. so you should have Player, GO attached to it with audio trigger and audio script, GO attached to player with trigger and script for scene
Okay, I got the main idea, but I'm still with grouping the trigger with GameObjects, but you lost me when you starting talking about the player.
as i understand, your audio and scene triggers are placed on single object, also as scripts that handles trigger enters? so my answer will solve this problem 8)
why is it happens?
trigger attached to GO on trigger_enter event sends message to ALL components of this GO. so, 2 components (scene loader and audio) gots this message and starts it's job.
one question 8) how do you attached one trigger to audio and second trigger to scene loading if all of this attached to single GO? 8)
Your answer
Follow this Question
Related Questions
Can I play multiple AudioSources from one gameobject? 8 Answers
foreach script check if boolean is true 3 Answers
Peculiar multiple-rigidbody-trigger problem. 2 Answers
Multiple Sound Effects? 1 Answer