On this page
Tools to fix problems and make sense of your architectureLast updated: November 2018
What you will get from this page: Richard Fine’s top three tips to improve your scripting experience in Unity. Follow these tips for more efficiency in your development, and less pain!
As a developer who spends a lot of time participating in the Unity community, Richard has helped many customers improve their scripting. Here he gives advice on effective use of the debugger, the “revolutionary” power of the ScriptableObject class and when to optimize your project.
Learn to use the debugger effectively
While you can go a long way diagnosing problems using Debug.Log, the debugger can help you diagnose a problem faster and in more depth. If you’ve never used it before, we have guides for both Visual Studio and VS for Mac’s predecessor MonoDevelop – and if you have, I recommend taking the time to explore all the things the debugger will let you do, such as setting conditional breakpoints or using the Immediate window.
Add the ScriptableObject class to your mental toolbox of scripting techniques
The ScriptableObject class is an often-overlooked part of the Unity API. Understanding ScriptableObject can help you to build a much cleaner, more elegant architecture; it can help you to keep things simple, be more data-driven, and achieve a better separation of concerns in your project. For a full explanation of ScriptableObject, plus examples of how you might apply it, there have been some great Unite talks - I gave an introduction to the subject, and others have taken it further, such as in this great talk by Ryan Hipple from Schell Games. There’s also a video class from Unity’s Learn team.
Optimize throughout your development process, not just at the end
Sometimes the right answer to a performance problem is to change your game’s design, and the later in the project you optimize, the harder it will be to make that kind of change. When you’re optimizing, the Stats window in the Game view is a good start, but to really understand your problems you should use the Profiler – there’s a huge amount of information packed in there–and to get the most accurate results, you should profile your game while it is running as an actual build, rather than in the Editor.
The Profiler window