1
This commit is contained in:
parent
b9c79e16a5
commit
fd46223352
@ -19,8 +19,6 @@ namespace UnityEngine
|
|||||||
Object.Destroy(obj);
|
Object.Destroy(obj);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
private static readonly List<Transform> s_CachedTransforms = new List<Transform>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取或增加组件。
|
/// 获取或增加组件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,20 +81,5 @@ namespace UnityEngine
|
|||||||
return gameObject.scene.name != null;
|
return gameObject.scene.name != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 递归设置游戏对象的层次。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gameObject"><see cref="GameObject" /> 对象。</param>
|
|
||||||
/// <param name="layer">目标层次的编号。</param>
|
|
||||||
public static void SetLayerRecursively(this GameObject gameObject, int layer)
|
|
||||||
{
|
|
||||||
gameObject.GetComponentsInChildren(true, s_CachedTransforms);
|
|
||||||
foreach (var tf in s_CachedTransforms)
|
|
||||||
{
|
|
||||||
tf.gameObject.layer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_CachedTransforms.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using System.Globalization;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using AlicizaX;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ using UnityEngine.UI;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace AlicizaX
|
namespace UnityEngine
|
||||||
{
|
{
|
||||||
public static class GameHelper
|
public static class GameHelper
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace AlicizaX
|
namespace UnityEngine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏对象帮助类
|
/// 游戏对象帮助类
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AlicizaX
|
namespace AlicizaX
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user