Skip to content

Instantly share code, notes, and snippets.

@adeubank
Created August 27, 2018 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adeubank/b799ea1f0e99db97c0ec472317347f64 to your computer and use it in GitHub Desktop.
Save adeubank/b799ea1f0e99db97c0ec472317347f64 to your computer and use it in GitHub Desktop.
// find a game object in the active scene
using System.Linq;
GameObject worldGameObject =
GameObject.FindGameObjectsWithTag("World").ToList().Find(o => o.scene == activeScene);
if (worldGameObject != null)
{
Debug.Log("SetTrigger: SceneExit" + worldGameObject.name);
worldGameObject.GetComponent<Animator>().SetTrigger("SceneExit");
}
else
{
Debug.Log("Did not find a world game object in active scene." + activeScene.name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment