Search Unity

[Released] Nut Library - Extensions and Utilities

Discussion in 'Assets and Asset Store' started by Igor_Vasiak, Oct 6, 2020.

  1. Igor_Vasiak

    Igor_Vasiak

    Joined:
    Dec 13, 2016
    Posts:
    44
    You know, coding can be quite slow at times, be it from writing lots of boilerplate code, really large scripts, or even because there are too many bugs in the code that are too hard to locate. Well, I had all those same problems some years ago (still do at times) but, because of that, I made a Library whose goal is to avoid much of this nonsensical coding.

    The power of utilities coupled with the flexibility of extensions and the right mindset, well, it can do wonders. I don't make Unity projects without this tool, because it just feels way too cumbersome to code. Another situation where the Nut Library might be good at is for prototyping. It can go much faster and with way fewer bugs, and the code will end up much more readable and modifiable.

    After a long time of polishing and re-writing this Library, I thought it'd be nice to share it with the world. So, if you feel like you could use something like it, go visit its Asset Store page at https://assetstore.unity.com/packages/slug/180266.

    This tool is also included in my Elery Object Pooler package if you feel interested: https://assetstore.unity.com/packages/slug/180280

    Here's a demo video!


    I'll run you through its top features:

    Array Management: Over 20 extensions for Arrays and Lists. You can make an array out of any value, get relative indexes easily, and even use a version of First and Last that doesn't require a predicate! You can also get random items from them, parent or unparent any entire array of GameObjects, or just set them active or inactive, who knows? You can retrieve the item next to an index with just a method, fill a color array with random colors, and much more still. All of what I just wrote also applies to lists.

    Color Control: You can control your colors like never before. Make them into grayscale colors using various algorithms, shift entire arrays of colors to another color, make a Texture2D black and white, lerp it into another color.

    Texture2Ds and Sprites: You can duplicate Texture2Ds and copy their data around easily, set the Filter Mode via a method, get the texture's area via a method, you can get the average brightness of an image, get a Sprite's pivot with normalized values, and duplicate sprites.

    Distance and Direction: You can calculate them on the go. Like this:
    this.Dist3(other);


    ToVec and ToRGB: Convert any kind of numeral value into a Vector or a Color the way you do ToString. You can even convert Vector4s into Colors and Color32s and back!

    And there's more, much more. There are also demo scenes for you to play with if you feel like it.

    There's a Discord community dedicated to the Nut Library and any tools developed using it as a base, such as the Elery Object Pooler. I'd recommend you to join the Nut Tools Discord community if you feel like helping people out or if you need to get some help, or even if you want to suggest new features that I might just add! You can also vote on what features you want to see coming first to the tool.