com.soviby.unity.ui.ugui-to.../Assets/Editor/Helper/EntityHelper.cs
2024-12-06 18:46:00 +08:00

35 lines
889 B
C#

#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public static class EntityHelper
{
public static void UpdateHierarchyOfEntity(in bool show, in GameObject entity)
{
entity.hideFlags = show ? HideFlags.DontSave : HideFlags.HideAndDontSave;
}
public static void UpdateSceneVisibilityOfEntity(in bool show, in GameObject entity)
{
if (show)
{
SceneVisibilityManager.instance.EnablePicking(entity, true);
}
else {
SceneVisibilityManager.instance.DisablePicking(entity, true);
}
}
public static void UpdateHierarchyAndSceneVisibilityOfEntity(in bool show, in GameObject entity)
{
UpdateHierarchyOfEntity(show, entity.gameObject);
UpdateSceneVisibilityOfEntity(show, entity.gameObject);
}
}
#endif