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 […]
Month: July 2015
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 icons to see invisible object on scene
Your game scene may consist of objects that are visible on your scene view (like mesh) and objects that are not visible there (like script holders). You may find yourself in a situation when these invisible objects should have certain position, rotation, or scale, but the only way to select these would be clicking on the object […]
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 […]