deltavr multiplayer 2.0
This commit is contained in:
39
Assets/FishNet/Runtime/Utility/Performance/Transforms.cs
Normal file
39
Assets/FishNet/Runtime/Utility/Performance/Transforms.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using FishNet.Object;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FishNet.Utility.Performance
|
||||
{
|
||||
|
||||
public static class GetNonAlloc
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private static List<Transform> _transformList = new List<Transform>();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private static List<NetworkBehaviour> _networkBehavioursList = new List<NetworkBehaviour>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets all NetworkBehaviours on a transform.
|
||||
/// </summary>
|
||||
public static List<NetworkBehaviour> GetNetworkBehaviours(this Transform t)
|
||||
{
|
||||
t.GetComponents(_networkBehavioursList);
|
||||
return _networkBehavioursList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all transforms on transform and it's children.
|
||||
/// </summary>
|
||||
public static List<Transform> GetTransformsInChildrenNonAlloc(this Transform t, bool includeInactive = false)
|
||||
{
|
||||
t.GetComponentsInChildren<Transform>(includeInactive, _transformList);
|
||||
return _transformList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user