- 50 Unity Tips #27: Custom Folder Inspectors (21 Jun 2018)
By default, folders are rendered blank (left image) in the inspector. Wouldn’t it be much better if we could customize these inspectors somehow, for instance, adding a short description, valid file types or file naming conventions (right image)? Not only could this be beneficial for future you, but also for your current teammates!
- 50 Unity Tips #26: Decorator Drawers (20 Jun 2018)
A DecoratorDrawer is similar to a PropertyDrawer, except that it doesn’t draw a property but rather a decorative element based on a PropertyAttribute. Unlike property drawers, a decorator drawer isn’t associated with property fields, however it still needs to be placed above a field. Another difference is that there can be multiple DecoratorDrawer attributes above the same field. Also, unlike property drawers, if a DecoratorDrawer attribute is placed above a List or an array property field, the decorator will only show up once before the array and not for every array element.
- 50 Unity Tips #25: Property Drawers (19 Jun 2018)
Property Drawers are used to customize the look of certain controls in the Inspector window or the look of a Serializable class itself. Unlike Custom Editors which customize a single MonoBehavior or ScriptableObject, Property Drawers customize the look of every instance of the Serializable class. Moreover, by using custom PropertyAttributes, the look of all class properties with a specified attribute can be easily customized.
- 50 Unity Tips #24: Context Menus (18 Jun 2018)
In #17-CustomEditorWindows we discussed how we could create a custom editor displaying a button that once pressed, executes a function within the component’s script. Personally I like the simplicity of a button inside the inspector, however if one only needs to execute a function from the editor, then writing a custom editor for the component is overkill. One alternative is to use the component’s context menu.
- 50 Unity Tips #23: Pseudolocalization (31 May 2018)
Internationalization is the process of designing a software application so that it can easily be adapted to various other languages and regions without any programming changes. Localization is the process of adapting internationalized software for a specific region or language by adding locale-specific components (€2.99 => 2,99€) and translating text (Hello World! => Hallo Welt!). Pseudolocalization is a software testing method used before the localization process in which a fake (or pseudo) translations (with the region and language specific characters) are generated:
Hello World! => Hellö Wörld!|ÜüäßÖ
- 50 Unity Tips #22: Android Device Filter (30 May 2018)
Tucked away in Player Settings - Android - Other Settings, there is a Device Filter setting with the options FAT (ARMv7 + x86), ARMv7 and x86. There are many approaches to reducing the build size for Android, but one sure approach is to change the default device filter from FAT (which builds a combined executable compatible with both ARMv7 and x86 architectures), and build separate builds for ARMv7 and x86, where the x86 build has a higher build number than ARMv7. Although this requires building two builds, you will reduce the actual install sizes by about 10MB.
- 50 Unity Tips #20: Asset Postprocessor (16 Mar 2018)
AssetPostprocessor is an Editor class which allows access to the import pipeline and the ability to run scripts prior or after importing assets. Each asset to import has an assetImporter and an assetPath, both of which are accessible in Preprocess and Postprocess callbacks. The assetImporter itself can either be an AudioImporter, IHVImageFormatImporter, ModelImporter, MovieImporter, PluginImporter, SpeedTreeImporter, SubstanceImporter, TextureImporter, TrueTypeFontImporter or VideoClipImporter, depending on the asset being imported.
- 50 Unity Tips #19: Loading an Array of Assets at Path (15 Mar 2018)
AssetDatabase allows us to easily load an asset in editor mode using the
- 50 Unity Tips #18: Custom Menu Items (14 Mar 2018)
The Unity editor allows adding custom menus which look and behave like built-in menus. This can be especially useful for adding commonly used functionality used throughout a project, for instance opening a scene in the editor, resetting all game data or triggering cheats to test gameplay etc.
- 50 Unity Tips #17: Custom Editor Windows (13 Mar 2018)
One of the most powerful features of the Unity editor is the ability to create custom windows and inspectors. We have already seen how we can use attributes such as [Range], [ToolTip], [HideInInspector], [HeaderAttribute] etc. to customize a component’s inspector. However, by writing a custom editor script for a component or asset, we can define exactly how the inspector should look, include useful buttons, visual the data etc.
- 50 Unity Tips #15: Pimp the Inspector (11 Mar 2018)
When a script inheriting from MonoBehaviour is attached to a GameObject, detailed information about that GameObject’s properties are displayed in the inspector window. If the GameObject has a lot of properties, the inspector can seem cluttered, making it difficult to find specific properties. Moreover, when the script writer isn’t the person actually viewing the inspector, it would be good to display additional information and verify input when possible. Luckily there are a number of attributes which can help us achieve this.