// // /*=============================================================================== // // Copyright (C) 2023 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the Phantom.XRMOD.UnityFusion.Runtime.CodeHook.Editor. // // // // The PicoPlatform cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact info@phantomsxr.com for licensing requests. // // ===============================================================================*/ using System.Collections.Generic; using UnityEditor; using UnityEngine; namespace Phantom.XRMOD.Runtime.Editor { public static class Utilities { public static float MakeSureHeight => EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; public static string[] GetLayerNamesFromMask(LayerMask _layerMask) { List tmp_LayerNames = new List(); // 遍历32个层,检查它们是否在LayerMask中 for (int i = 0; i < 32; i++) { // 检查层是否在LayerMask中 if (((1 << i) & _layerMask) != 0) { // 获取层的名称,并添加到列表中 string tmp_LayerName = LayerMask.LayerToName(i); tmp_LayerNames.Add(tmp_LayerName); } } return tmp_LayerNames.ToArray(); } } }