Have you ever found yourself in a situation that the object you’ve put into the scene can be selected too easily or is covering some other important scene objects? What can you do about it? Well, you can disable this object every time when you don’t want to see it. However, you can easily forget about enabling it when […]
Tag: Tips
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 […]
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 […]
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 […]
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 […]
Profiling Unity Application with Profiler Samples
The Unity Profiler Samples is something that most of Unity users are unaware of. Yet it can be extremely helpful if you want to find out what amount of resources your code takes during the execution. If you’re already familiar with built-in profiler then you might know that by default it is not profiling all method calls. Also, […]
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 […]
You can restore unsaved scene after Unity crash
Unity as any other software out there may crash from time to time. It’s not a big deal unless the last time you saved your scene file was somewhere near your lunch and now you are just about to end your workday. Do you know that feeling? Have you just lost many hours of hard work? Maybe not! Even if you […]
Use Invoke methods to execute code at a given time
What if you need to invoke a specific code in 2 seconds? You can write an accumulator that counts time, use coroutine to wait for 2 seconds or simply use Invoke or InvokeRepeating methods. Invoke Invoke is a public method of MonoBehaviour class (so you can access it from your game scripts). It takes method name and time as […]
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 […]
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 […]
Use decorator drawers to improve inspector view of your scripts
If you’re writing a custom script then most probably you want to manipulate its public field values from the Inspector. By default, the Inspector fields are placed next to each other and the field name is the only information that you receive. You can write a custom editor, but this requires creating another script with a […]