- Home /
Pause player OnTrigger Enter while voiceover plays, then releases player.
Does anyone have a simple script that will allow the player to enter a trigger, stop the player while a voice over plays and then once its done playing release the player?
Answer by WarmedxMints · Mar 20, 2019 at 07:03 PM
You could just disable the player controller;
private void OnTriggerEnter(Collider other)
{
var player = other.GetComponent<MyPlayerController>();
if(player != null)
{
player.enabled = false;
}
}
Then enable it again when your voice over has finished.
Answer by HammerVise · Mar 20, 2019 at 08:02 PM
Thank you, you'll have to forgive my follow up but how do I set the time? I was going to see how long the audio clip was then match that up to how long the player would be stuck in the trigger. also I'm not sure how I would tell the script to re-enable the player to move after the voice over has been completed, an if statement? ..I can follow the logic but yes I'm pretty new to C#
Your answer