Releases: XDracam/unity-corelibrary
Version 0.0.7 - Vector and Color utilities
Highlights
Vector and Color extensions
myVector.With(x: 5, w: 2)and analogue for colors- added all
WithX-style methods to Vector4 and Color as well
Swizzling
Like in many shader languages, the CoreLibrary now has Swizzling:
var vec = new Vector4(1, 2, 3, 4);
AssertEquals(vec.zyx(), new Vector3(3, 2, 1));
var vec2 = new Vector2(1, 2);
AssertEquals(vec2.xxyy(), new Vector4(1, 1, 2, 2);
val col = new Color(.1f, .2f, .3f, .4f);
AssertEquals(col.arbg(), new Color(.4f, .1f, .3f, .2f);Search.InSiblings
All methods that take an optional Search parameter can now search their direct siblings if there are any. A sibling is a child of an objects parent.
Is with out param
We now support obj.Is<Renderer>(out var renderer, Search.InChildren) This supports the C#7 style if (obj is Renderer renderer) pattern for components.
Do and DoNothing for Coroutines
We now support wrappers for 'instant' coroutines - they execute their code and end immediately. Do takes a Codeblock and turns it into an IEnumerator, and DoNothing is the empty coroutine.
IfNotNull
Unity has issues with comparing with null. This is why you cannot use C#'s builtin ?. and ?? syntactic constructs with unity objects. So we now have multiple versions of obj.IfNotNull(action: () => { ... }, elseAction) which either return a value or don't.
ForEach with index
myList.ForEach((elem, i) => { ... });ForEach now takes the index of the current element as second parameter, as an alternative to the index-less version.
IEnumerable.IsEmpty and .IsNotEmpty
For readability reasons, you can now use myList.IsEmpty() and mylist.IsNotEmpty() as extension methods!
Seq for turning varargs into an IEnumerable
Ever had a method that takes an IEnumerable<T> and you wanted to pass a constant amount of args? People often do
MyMethod(new [] { arg1, arg2 });but you can now write
MyMethod(Util.Seq(arg1, arg2));This amounts to less confusion when others read your array literal.
SetPerceivable disables Queryables
When an object was set to imperceivable, it was still queryable. These two features now play together properly.
Asset Store Upgrade
Incorporated issues which were collected over the last few months. Planning on better using issues and commits for proper patch notes in the future.
Version 0.0.4 - Asset Store Release
The project in it's current state is ready for asset store release.