com.stansassets.foundation
com.stansassets.foundation copied to clipboard
Collection of utility methods, design patterns, and extensions for Unity.
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...
https://github.com/StansAssets/com.stansassets.foundation/blob/master/Runtime/Extensions/UnityEngine/Vector3Extensions.cs#L16-L22 this is the same as: `return (b - a).sqrMagnitude` (https://docs.unity3d.com/ScriptReference/Vector3-sqrMagnitude.html) https://github.com/StansAssets/com.stansassets.foundation/blob/master/Runtime/Extensions/UnityEngine/Vector3Extensions.cs#L30-L36 this is the same as `return a * s` (https://docs.unity3d.com/ScriptReference/Vector3-operator_multiply.html) https://github.com/StansAssets/com.stansassets.foundation/blob/master/Runtime/Extensions/UnityEngine/Vector3Extensions.cs#L44-L51 this is the same as `return Vector3.Sacle(a,...
https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Utilities/TimeUtility.cs#L20 the TimeUtility class is based on DateTime, which means it breaks when pausing the play mode in the editor (timers should not proceed while paused). Relying on Time.time OR...
Just stumbled upon this project. was looking through the code a bit and found the Enum Utility: https://github.com/StansAssets/com.stansassets.foundation/blob/b3332055c35bb65162e22570b14c06d59ff4155e/Runtime/Utilities/EnumUtility.cs#L9 A bit of code-review: - all methods should have generic constraints: `where...
## Purpose of this PR Audio Center allows playing audio clips using pooled audio sources. Right now has only limited support of playing 2D sounds with only ability to: *...
This is the [reference](https://www.reddit.com/r/Unity3D/comments/2qsor5/heres_a_way_to_call_methods_on_components_without/) ### Please skip this task until you will see the opposite in the description.
public static void SetLeft(this RectTransform rt, float left) { rt.offsetMin = new Vector2(left, rt.offsetMin.y); } public static void SetRight(this RectTransform rt, float right) { rt.offsetMax = new Vector2(-right, rt.offsetMax.y); }...