Wednesday, February 14, 2018

Supercharged Gizmos for your SceneView

This code shows how I use the [DrawGizmo] attribute to create special gizmos for my components, which only appear when you're actually near the component.

Wednesday, January 03, 2018

Allocations in the Unity Editor when using GetComponent.

If you call gameObject.GetComponent, and there is no Collider on that gameObject, null is returned, but you will also see a memory allocation in the Unity profiler.


The call is actually returning a "fake null" object, so that when you try and use it a custom error message is displayed. This custom error message causes the allocation.

This behaviour is disabled in a build, so you will only ever see it in the editor.

Popular Posts