Created
September 8, 2016 05:05
-
-
Save psema4/6fa53386e6a0452ac1e0438fa677efe6 to your computer and use it in GitHub Desktop.
Useful strategy to manage "unlimited" cameras in Unity 3D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: Archimagus on "Most efficient way to incorporate CCTV screens in Unity?" | |
// https://www.reddit.com/r/Unity3D/comments/2z7u4c/most_efficient_way_to_incorporate_cctv_screens_in/cpgql85 | |
Camera[] _securityCameras; | |
void Start() | |
{ | |
foreach(var s in _securityCameras) | |
{ | |
s.enabled = false; | |
} | |
StartCoroutine(UpdateCameras()); | |
} | |
IEnumerator UpdateCameras() | |
{ | |
while (true) | |
{ | |
for (int i = 0; i < _securityCameras.Length; i++) | |
{ | |
_securityCameras[i].Render(); | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment