Tag: Unity
- Unity Continues to Steadily Improve (06 Jul 2018)
I know I may have mention this a few times before, but SpriteKit for iOS9 was a disaster. Although it included some really cool features (SKAudioNode) and the addition of GameplayKit, it seemed broken, supporting older versions of iOS (7 and 8) was a pain and there was little to no feedback from Apple. Eventually, the release was stabilized and the company I worked for released their educational game. I then started to cheat on SpriteKit by learning Unity, before pivoting to using it solely professionally. - Unite Berlin (22 Jun 2018)
Although I wasn’t able to attend Unite in Berlin this year, I’ve been tuning into the livestreams which are now available to watch in full on YouTube. - 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. - #GameInAWeek: Sultan's Gems (13 Jun 2018)
Sultan’s Gems is a simple Match 3 game in which the player tries to achieve a high score within a certain number of moves by matching similar pieces. The project was created for educational purposes as part of James’ #GameInAWeek challenge and is released freely under an MIT license. It may be of interest to those looking for a starting point in creating a Match 3 game in Unity for mobile. Source - 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 #21: Singletons (19 Mar 2018)
The singleton pattern is a design pattern that restricts the instantiation of a class to a single, globally accessible instance. This is particularly useful when a single instance is needed to coordinate actions across an entire project. The benefits of this approach are clear:- we have a global pointer which we do not need to tediously pass to all classes who need to reference it.
- as the class is initialized at runtime, it can utilize runtime information (unlike static classes).
- the class can be lazily instantiated, that is, only created once the instance is first needed. This can be quite helpful for resource-heavy classes. Static classes are created when first loaded.
- 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 theLoadAssetAtPath
method: - 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 #16: OnValidate (12 Mar 2018)
Yesterday we talked about the [Range] attribute which ensures that float/int values entered in the inspector are constrained to a certain range, thus ensuring valid input. However wouldn’t it be great to validate data for all properties, not just those of type float and int? - 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. - #GameInAWeek: Idle Capitalist (11 Jan 2018)
Idle Capitalist is an idle clicker game inspired by AdVenture Capitalist in which the player invests funds into certain businesses to generate revenue. The project was created for educational purposes as part of my #GameInAWeek challenge and is released freely under an MIT license. This project may be quite useful for those looking for a starting point in creating an idle game in Unity for mobile. Source - #GameInAWeek: Tappy Plane (14 Dec 2017)
Tappy Plane is a Flappy Bird style endless runner in which the player taps the screen to fly their plane in between obstacles, thus earning coins which can be used to unlock other planes and levels. The project was created for educational purposes as part of my #GameInAWeek challenge and is released freely under an MIT license. This project may be quite useful for those looking for a starting point in creating an endless runner in Unity for mobile. Source - 50 Unity Tips #14: Custom C# Script Template (11 Dec 2017)
When one creates a new C# Script in Unity, they are presented with the following code automatically: - 50 Unity Tips #13: iOS Launch Screen (10 Nov 2017)
On Startup, a Unity game will display the splash screen (if enabled) before loading the first scene. However, if you launch the game on iOS, you will notice the following bluescreen before the splash screen/first scene. - Unity or SpriteKit for 2D iOS Game Development? (09 Nov 2017)
Images courtesy of Apple, Microsoft and Unity respectively. - 50 Unity Tips #12: Preloading Mobile Signing (31 Oct 2017)
To publish on Google Play, one needs to sign their app with a keystone signature file. Various aliases (i.e. users) can be authorized to use this file, each with their own password. In the Android Publishing section, we can select the keystone and alias, and enter their respective passwords. - 50 Unity Tips #11: On Screen Log Messages (21 Sep 2017)
Today’s tip is short and sweet but extremely useful for mobile devices: on screen log messages. - New Pół na pół minigames (08 Jul 2017)
Here are some screenshots from two mini-games I created for Pół na pół where one must match an image to a list of words, or type a word for a given image. - 50 Unity Tips #10: XML Serialization (09 Jun 2017)
XML (Extensible Markup Language) is a human-readable and machine-parsable markup language which defines a set of rules for encoding a document. C# has built-in XML serialization with the following noteworthy points: - 50 Unity Tips #09: JSON Serialization (08 Jun 2017)
JSON is a human-readable and machine-parsable lightweight data-interchange format which serializes data objects as text strings. Unity’s JSONUtility supports serializable classes but is somewhat limited in that 1) it does not support dictionaries or top level arrays, and 2) all properties must be public. - 50 Unity Tips #08: Scriptable Objects (07 Jun 2017)
A ScriptableObject is a data container which- has similar functionality to MonoBehaviour but cannot be attached to a GameObject
- supports Serialization and can be saved as an asset in the Unity project
- can be loaded on runtime but not saved => not suitable for saving a game state
- serialization/deserialization is built in and fully functional, unlike JSON, XML
- persists settings changed during editor play mode to disk
- optimizes the loading of data, by loading it only when needed
- 50 Unity Tips #07: Binary Serialization (06 Jun 2017)
Serialization is the process of converting an object (or an entire graph of connected objects) into a stream of bytes so that it can be recreated again when needed (deserialization) [MSDN]. In Unity there are four predominate ways to serialize objects:- Binary Format
- Scriptable Objects
- JSON
- XML
- 50 Unity Tips #06: Player Preferences (05 Jun 2017)
PlayerPrefs is a static class which one can store and access player preferences between scenes and game sessions. The class is useful for storing basic values but has two main drawbacks: - 50 Unity Tips #05: Custom Invoke (02 Jun 2017)
public void Invoke(string methodName, float time)
allows one to trigger a given method (via string methodName) after a delay of time seconds. However there are two notable issues: - 50 Unity Tips #04: More Efficient Yield Statements (01 Jun 2017)
When looking at Coroutine code online, one often sees something like - 50 Unity Tips #03: Rich Text (31 May 2017)
You are probably familiar with the UI Text component in which text can be added to a UI canvas. - 50 Unity Tips #02: Extension Methods (30 May 2017)
Extension Methods allow us to add functionality to existing classes. Say for instance we want to set the X position of a Transform. We could write a private method within our class MyGameObject but as this is probably something that we could use across multiple classes, it makes more sense to create an Extension Method - 50 Unity Tips #01: Git Version Control (29 May 2017)
Version control is something that I’m sure most are familiar with (if not check out this tutorial and this course), but something that you may not be familiar with is how to optimize a Unity Project for Git version control. - Deklinator Early Prototype Screenshots (02 Apr 2017)
Here are some screenshots of Deklinator, a very early prototype of a Declension-based game for learning polish. The game can be played here.