Tag: csharp - page 2
-
Aug 25, 2015
Custom editor controls in Unity - Part 2: Buttons
I think that a great place to start with custom control development is to re-create the
GUI.Button
andGUILayout.Button
controls since these are straightforward to create and helps to establish some of the fundamentals of custom control development. Our custom button implementation will be used in the exact same way as the regular button controls: -
Aug 24, 2015
Custom editor controls in Unity - Part 1: Events
I frequently develop custom controls for custom editor windows, inspectors, property drawers, etc when working on Unity projects to ease project workflows. People often ask how I create these controls so I thought that I would dedicate a blog post towards it for anyone that might be interested.
-
Jul 9, 2015
Ordered dictionary for Unity
When working on projects it is often useful to have some sort of asset that maps values to keys. Since Unity doesn’t currently support the serialization of dictionaries this is something that I either try to avoid needing entirely or that I end up having to reinvent each time by implementing the ISerializationCallbackReceiver interface following the example in Unity’s documentation.
-
Apr 21, 2015
Maintaining asset releases for multiple versions of Unity
When Unity 4 was released I was able to continue to provide support for Unity 3 by tweaking logic so that it would satisfy both of the releases of Unity and in a couple of circumstances to use reflection to transparently select between Unity 3 and Unity 4 APIs. This mainly affected editor logic and so it was possible to get JIT compiled delegates to make the reflected invocations more efficient.
-
Mar 22, 2015
Designer friendly component scripts with Unity events
Unity recently introduced a serializable
UnityEvent
class which allows scripts to expose events in the inspector allowing designers to wire up handlers without coding. This is a really powerful feature because it allows developers to implement components that can now be assembled much more freely by designers… almost like a basic form of visual scripting. -
Mar 2, 2015
Pixel perfection in 2D game projects
Pixel perfection can be a little more complicated to achieve when using a 3D game engine than one might initially think. There are many small contributing factors to unwanted side effects such as edge bleeding, fuzziness, flickering edges, non-uniformly shaped pixels, inconsistently shaped pixels, etc. To make things harder the solutions and workarounds often vary on a case by case basis.
-
Oct 10, 2013
Adding reorderable lists to editor interfaces in Unity
Often I find myself in need of reorderable list functionality in my various custom editor interfaces, and so I decided to create a generalized implementation which works with generic lists List<T> and with SerializedProperty.
-
Sep 18, 2013
Initialization at runtime from a configuration asset
Often when working with Unity I have the need to automatically initialize “controller” objects which live across scenes. In the past I have typically created an initialization scene and used DontDestroyOnLoad. Whilst this works it makes debugging scenes a lot tricky since you cannot just hit the “Play” button.
-
Apr 30, 2013
Adding the little padlock button to your EditorWindow!
One of the less well known features of Unity is the little padlock button that lives in the upper-right corner of the Inspector window. This button is fantastic because it causes the inspector to ignore future selections and thus allowing you to select other objects without affecting the contents of the inspector.
-
Jul 16, 2012
Possibility of reusing custom editors in a custom window?
Several weeks ago I had some ideas that would add lots of flexibility to my custom editor window. In a nutshell the idea was to add, modify and remove certain components. To be honest I thought that this would be relatively easy because this functionality is already available within Unity inspector windows. I remembered seeing
EditorGUILayout.PropertyField
and I foolishly assumed that would do the trick, but I was wrong…