Over the years, I've worked on a lot of projects and game jam prototypes with Unity3D and there are some pieces of code that I've needed time and time again. I'm sharing them here in the hopes that they are useful for you too!
Everything is released under the MIT License.
If you find any bugs or have suggestions, please add an Issue here or send me a mail at Tobias.Wehrum@dragonlab.de.
- Countdown: Useful for things like cooldowns or spawn delays. It is also helpful for tweening things by using the
PercentElapsed
property. - EditorHelper: Gets the
[Tooltip]
attribute content of fields for editor classes. Might get more helper methods in the future. - LINQExtensions: A collection of extension methods for
IEnumerable
,List
and arrays. - MathHelper: Helper methods for framerate-independent eased lerping, mapping and angles.
- MeshCreator: Makes it more convenient to create meshes via code.
- NoiseOutputValue: Enter a range and a speed in the editor, get an output value that fluctuates over time using Perlin Noise.
- RandomBag: A
RandomBag
gives you random items from a group while ensuring that in a certain interval every item was given back the same number of times. - Range: Editable data types that take an
int
/float
range. Used for things like "Spawn 2 to 4 enemies." - RollingArray: Collection that keeps the last x elements that are added to it.
- Singleton: Allows easy and convenient creation of a Singleton. Optionally makes a Singleton persist between scenes while ensuring that only one exists.
- UnityHelper: Contains a plethora of useful extensions and helpers for Transform, GameObject, Vector2/3/4, Rect and more.
- XmlHelper: Serializes data to XML strings and makes accessing optional element content and attributes in general XMLs easier.
To use the scripts, just drop them into the Assets folder of your projects. Or better yet, make an "Assets/Extensions/TobisUnityUtitilites" folder and drop them there. Hurray for proper organisation.
You can also just use selected scripts, but you should check the "Dependencies" section in the respective folder to make sure you copy everything you need.
The class documentation is available here.
- 2016-10-23: Fixed bugs/improved Singleton. Added EasedLerp methods for float in MathHelper and Vector2, Vector3 and Color in UnityHelper. Added CalculateCentroid in UnityHelper for arrays/lists of Vector2/3/4.
- 2016-10-22: Added MathHelper. Added randomization helper methods to UnityHelper.
- 2016-07-03: Added MeshCreator.
- 2016-06-19: Added XmlHelper.
- 2016-06-08: Added UnityHelper.
- 2016-06-05: Added EditorHelper and RollingArray. Added
[Tooltip]
forNoiseOutputValue
and edited the existingPropertyDrawer
to use tooltips. - 2016-05-15: Added LINQExtensions and RandomBag.
- 2016-05-09: Added the class documentation website.
- 2016-05-08: Added Countdown, NoiseOutputValue, Range and Singleton.
- 2017-09-26: Removed .gitignore. Update note: This will break any scene you use example scripts in and might cause one-time .meta conflicts if you track your projects with git and didn't remove the .gitignore yourself. I'm sorry.