fix: generated GameObject will be named '[generated] *'

These objects are automatically generated and are not stored in the scene or prefab (HideFlags.DontSave)
pull/289/head
mob-sakai 2023-08-18 17:20:12 +09:00
parent 821f08ff5c
commit 9b2e5c1d10
2 changed files with 6 additions and 4 deletions

View File

@ -572,20 +572,22 @@ namespace Coffee.UIExtensions
{
if (!canvas) return Camera.main;
// Render mode is not ScreenSpaceOverlay, use world camera.
// When render mode is ScreenSpaceCamera or WorldSpace, use world camera.
var root = canvas.rootCanvas;
if (root.renderMode != RenderMode.ScreenSpaceOverlay)
{
return root.worldCamera ? root.worldCamera : Camera.main;
}
// Create ortho-camera.
// When render mode is ScreenSpaceOverlay, use ortho-camera.
if (!_orthoCamera)
{
_orthoCamera = GetComponentInChildren<Camera>();
// Create ortho-camera.
if (!_orthoCamera)
{
var go = new GameObject("UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave };
var go = new GameObject("[generated] UIParticleOverlayCamera") { hideFlags = HideFlags.DontSave };
go.SetActive(false);
go.transform.SetParent(transform, false);
_orthoCamera = go.AddComponent<Camera>();

View File

@ -149,7 +149,7 @@ namespace Coffee.UIExtensions
public static UIParticleRenderer AddRenderer(UIParticle parent, int index)
{
// Create renderer object.
var go = new GameObject("UIParticleRenderer", typeof(UIParticleRenderer))
var go = new GameObject("[generated] UIParticleRenderer", typeof(UIParticleRenderer))
{
hideFlags = HideFlags.DontSave,
layer = parent.gameObject.layer