Executing Custom Scripts from Unity’s Menu

You can do wonderful things with your Unity editor via scripting. For instance, you can write a script to populate your scene with random objects. All you need is a method of executing those scripts. Let’s talk about how to put your scripts into any menu. For this purpose, we will use MenuItem annotation and write […]

Read More…

Hold the Alt button to expand or collapse the Hierarchy

Did you know that by holding the Alt button while clicking on Hierarchy or Project window arrows you can completely expand or collapse its contents? It can be especially useful when there’s a lot of items that you’d like to collapse or expand. The trick is to hold the Alt button when clicking on the expand arrow to completely […]

Read More…

Using the Unity Cache Server

  If you’re working on a medium or big project then you may get into a situation when pulling your project from the repository (or switching to a different branch) triggers a time-consuming process of asset importing.  It can be even more painful if you’re targeting at mobile devices like Android and iOS. For instance, on iOS textures or […]

Read More…

You can search your scene objects by component’s type

Did you know that besides searching your Hierarchy window by object name you can actually filter your scene objects by component names they have? As you already know, there’s a small search input on top of Hierarchy window. It allows you to search for scene objects by name. When you start typing in the input, the object list will […]

Read More…

You can switch your Inspector into the debug mode

Unity Inspector is extremely useful tool when it comes to tuning up your game objects and components. By default, the inspector is displaying only public and serializable fields, but sometimes you may need to know more about your objects state. You may want to include Debug.Log() function calls in your code. Usually, this is the fastest way of […]

Read More…

Custom gizmos with OnDrawGizmos

Did you know that by implementing OnDrawGizmos() method in your scripts you can draw a custom gizmo? Last time we talked about how to use icons’ settings to assign various icons to invisible game objects. Yet if you have some experience with scripting then you can create your own gizmos. Basic Example Gizmo drawing can be done using […]

Read More…

Use CustomEditor to customize your script inspector

When your scripts are getting bigger, then usually the number of properties is greater too. Unity, by default, is using the most generic way to display these properties because it does not know the context. You can use decorator attributes but that’s not the only way you can deal with it. In fact, Unity gives you complete freedom to […]

Read More…

Use Debug.Break() to pause Unity editor from the code

You can pause your game from the editor any time you want. But did you know that you can trigger the pause from the code based on some condition? There’s a console option called Error Pause. When enabled, it will pause your game when any run-time error occurs. When your game is paused, you can easily investigate what is […]

Read More…

Use unitypackage files to share part of your project

Did you know that there’s an easier way to share your Unity project files than zipping it all into a single archive? Check the unitypackage file format! Unitypackage is a basic distribution format of the Unity Asset Store and you might not have even known about it because it is completely transparent for the end user! Yet you can […]

Read More…

ExecuteInEditMode will run your script in edit mode

You might be familiar with the workflow that all of your game scripts are working only when you hit the Play button. Did you know that you can force some scripts to be running even when you’re in the edit mode? Why would you do that? I mean that you may have player scripts, enemies scripts, weapons […]

Read More…

Console log can show you which object is the creator

Most probably you already know about Debug.Log() function and its variations, but did you know that you can use it to find a particular object on the scene? Why would you do that? For instance, let’s say that you’re creating a shooting game. When a player shoots the object, you want to check if the bullet hits […]

Read More…