General Unity Utilities at your service - just some general level code to use as you wish!

Hello!

I decided to share some of my general level Unity code on GitHub. Includes code for tweening, singletons, data managing, UI etc. Contains also lots of extension methods.

Use as you wish: for inspiration, copy paste, or just to make you feel better about your own code :wink:

Not all of the code is solid or elegant, but I think that at least parts of it can be helpful to someone. Many scripts I’ve been using in many projects, some not very much. Most of it is born with particular requirements in mind, but refactored as general purpose later on.

If you’d like to contribute, feel free to fork the repo or contact me directly.

You can find the code here: GitHub - itchyOwl/general-unity-utilities: A collection of general Unity code that I reuse from a project to another..

Happy coding!

1 Like

What do you mean by this, these types are serialized just fine?

Unity can serialize them of course, but .Net BinaryFormatter cannot. Trying to serialize unity structs or classes will throw a serialization exception, because they are not marked Serializable. See for example this post . My comments are a bit unclear there, have to consider rewriting them.

I would add implicit operators for the conversions (both directions), instead of ToUnityXYZ, but that’s just personal preference.

Which operators would you use then?

implicit, he said. User-defined explicit and implicit conversion operators - provide conversions to different types - C# reference | Microsoft Learn

It’s cool that you shared your work :slight_smile:

Oh, wasn’t aware of them. I’ll take a look, thanks!

Using implicit operators makes it better. Unfortunately, when mapping with Linq Select you have to explicitly cast the types, but don’t see how that could be any other way. Thanks!