Closed soraphis closed 1 year ago
https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Extensions/UnityEngine/TransformExtensions.cs#L53-L67
using GetComponent is kinda inefficient. you can do this:
for(int i = transform.childCount-1; i >= 0; --i){ Object.DestroyImmediate(transform.GetChild(i)); }
https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Extensions/UnityEngine/TransformExtensions.cs#L80-L81
if you'd use part.SetParent(transform, false) you could skip the part.Reset() call.
part.SetParent(transform, false)
part.Reset()
Done in #108
https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Extensions/UnityEngine/TransformExtensions.cs#L53-L67
using GetComponent is kinda inefficient. you can do this:
https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Extensions/UnityEngine/TransformExtensions.cs#L80-L81
if you'd use
part.SetParent(transform, false)
you could skip thepart.Reset()
call.