Skip to content

Instantly share code, notes, and snippets.

@friuns2
Created July 31, 2018 10:45
Show Gist options
  • Save friuns2/db28886c1850d02770e5ea19b1cbc6fa to your computer and use it in GitHub Desktop.
Save friuns2/db28886c1850d02770e5ea19b1cbc6fa to your computer and use it in GitHub Desktop.
void Update()
{
foreach (var a in GetDontDestroyOnLoadScene().GetRootGameObjects())
{
if (a.name == "Imposter Camera")
{
a.hideFlags = HideFlags.None;
}
}
}
private Scene GetDontDestroyOnLoadScene()
{
GameObject temp = null;
try
{
temp = new GameObject();
DontDestroyOnLoad( temp );
Scene dontDestroyOnLoad = temp.scene;
DestroyImmediate( temp );
temp = null;
return dontDestroyOnLoad;
}
finally
{
if( temp != null )
DestroyImmediate( temp );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment