Helper classes that are useful for my projects
C#
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Assets
ProjectSettings
.gitignore
LICENSE
README.md

README.md

unity-helpers

Helper classes and tools that are useful for Unity projects.

Description

Currently this project is used with version 5.2 of Unity. This may be incompatible with other versions. If there is any bug, please open an Issue 👍.

Editor Tools

Mass Set Tags Tool

This tool simply sets the tags of all selected objects and their children. The class is UnityHelpers/EditorTools/Editor/MassSetTags.cs and it can be accessed via UnityHelpers -> Mass Set Tags

Apply Prefab Tool

Tool that applies changes to all selected prefabs. The class is located at UnityHelpers/EditorTools/Editor/ApplyPrefabTool.cs and it can be accessed via UnityHelpers -> Apply Selected Prefabs.

Open Git Bash Tool

Tool that opens git bash for this project. Only works on Windows and only if git bash is installed in the default location (either C:\Program Files\Git\git-bash.exe or C:\Program Files(x86)\Git\git-bash.exe). Code for this tool is found in UnityHelpers/EditorTools/Editor/OpenGitBashTool.cs and it can be accessed via Unity Helpers -> Apply Selected Prefabs

Remove hidden objects

Tool to remove hidden objects that are in the hierarchy. The code is in the file UnityHelpers/EditorTools/Editor/RemoveHiddenObjectsTool.cs. An in depth description of the tool follows but should not be necessary. The Menu command is Unity Helpers -> Remove hidden objects.

Helper Classes (Runtime)

Singleton

A singleton pattern implemenation is found under UnityHelpers/Singleton/Singleton.cs the full class name is UnityHelpers.Singleton.Singleton<T>.

Component extensions

An extension for getting or adding a component to a gameobject is located in UnityHelpers/Components/ComponentExtensions. This includes extension methods for GameObject and Component.

Helper Classes (Editor)

SerializedProperty Array Helpers

In the folder UnityHelpers/Scripts/EditorHelpers/Editor/ are the following classes that help with handling array SerializedProperties

  • ArrayHelpers: Provides helper methods for adding elements to SerializedProperty-Objects that are arrays
  • ArrayIterator: Iterator implementation for SerializedProperty-Arrays (you can use foreach with this)