fix: In rare cases, the generated camera (for baking) will not be deactivated

pull/169/head
mob-sakai 2021-05-11 16:22:36 +09:00
parent 0259ad2464
commit 12c748a8cd
1 changed files with 2 additions and 1 deletions

View File

@ -40,7 +40,7 @@ namespace Coffee.UIParticleExtensions
// Find instance in scene, or create new one. // Find instance in scene, or create new one.
return s_Instance return s_Instance
? s_Instance ? s_Instance
: (s_Instance = FindObjectOfType<BakingCamera>() ?? Create()); : (s_Instance = Create());
} }
} }
@ -55,6 +55,7 @@ namespace Coffee.UIParticleExtensions
var inst = gameObject.AddComponent<BakingCamera>(); var inst = gameObject.AddComponent<BakingCamera>();
inst._camera = gameObject.AddComponent<Camera>(); inst._camera = gameObject.AddComponent<Camera>();
inst._camera.enabled = false;
inst._camera.orthographic = true; inst._camera.orthographic = true;
// Turn camera off because particle mesh baker will use only camera matrix // Turn camera off because particle mesh baker will use only camera matrix