How to check you are in Play Mode in Unity3D

marcosecchi Tutorials, Unity3D 0 Comments

One of the first things you’ll learn when starting with Unity3D is that, during Play Mode, your changes won’t be persistent and will revert back once you stop playing. This feature has obviously been created to help the developer make changes and tests without affecting the scene. Unfortunately, during your first projects, you’ll forget about this and most of the …

C# Extension Methods in Unity

marcosecchi Tutorials, Unity3D 0 Comments

“Extension methods enable you to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference …

Creating Dynamic MenuItems in Unity

marcosecchi Tutorials, Unity3D 0 Comments

Lately I’ve been fiddling around with MenuItems in Unity for my Sprite Importer tool. Basically I needed a runtime generated menu for selecting a list of templates for the user. Unfortunately this is not possible in Unity (well… it makes sense, considering that menu items are generated at compile-time). However, I’ve found a quick and simple workaround for this: generate …