Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

How to pause a frame in unity , that works even in webgl ?

$
0
0
As i tried to use second camera to pause the frame(by rendering only UI elements before new game objects were loaded into the scene and then enable main camera to render everything) , which worked as intended in unity but there was a glitch in webgl before the first camera starts rendering . IEnumerator FreezeCam() { //saving previous culling mask and clearing flags Previous_mask = Camera.main.cullingMask; Previous_clear_flags = Camera.main.clearFlags; Camera.main.clearFlags = CameraClearFlags.Nothing; Camera.main.cullingMask = 0; yield return null; } IEnumerator Play_cam() { //assigning previous culling mask and clearing flags Camera.main.clearFlags =Previous_clear_flags; Camera.main.cullingMask = Previous_mask; yield return null; } public void secondary_camera_setting() { //Camera.main.enabled = false; if (secondary_Cam != null)//enabling secondary camera not to render anything { //to render only UI using culling mask secondary_Cam.enabled = true; secondary_Cam.cullingMask = 1 << LayerMask.NameToLayer("UI"); } } IEnumerator LoadGameObjects() { .................. ..................; StartCoroutine(Play_cam()); } void Start() { StartCoroutine(FreezeCam()); secondary_camera_setting(); UnityMainThreadDispatcher.Instance().Enqueue(LoadGameObjects()); }

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>