OnDrawGizmos Not Getting Called

This is similar to a previous thread, which has not been answered yet, in which Gizmos.DrawIcon() is not being called.

I’m actually working with the 2D Gameplay Tutorial, and in both the sample scene and the follow along tutorial scene, it appears that OnDrawGizmos is not being called. I believe this is the case because one gizmo calls Gizmos.DrawIcon() and another one sets up a boundary rectangle in the scene. Neither is occuring. Anyone have any experience with a similar issue?

Thanks,
Rob

Hi, welcome to the forum!

Have you checked if the function is being called with Debug.Log or print statements? Can you post your OnDrawGizmos function?

Keep in mind, I’m just using the 2D Gameplay Tutorial. When I open an unaltered version of the original project, without making changes, I get the same issue - none of the Gizmos appear on the screen, which makes setting up levels, etc. very tedious.

Here’s the OnDrawGizmos() function from the Spawn Point Game Object/Script:


// This script must be attached to a game object to tell Unity where the player starts in the level.

// We’ll draw a gizmo in the scene view, so it can be found…
function OnDrawGizmos() {
Gizmos.DrawIcon(transform.position, “Player Icon.tif”);
}


Here’s one from the Level Attributes Game Object/Script:


function OnDrawGizmos () {
Debug.Log (“In On DrawGizmos()”, gameObject);
Gizmos.color = sceneViewDisplayColor;
var lowerLeft = Vector3 (bounds.xMin, bounds.yMax, 0);
var upperLeft = Vector3 (bounds.xMin, bounds.yMin, 0);
var lowerRight = Vector3 (bounds.xMax, bounds.yMax, 0);
var upperRight = Vector3 (bounds.xMax, bounds.yMin, 0);

Gizmos.DrawLine (lowerLeft, upperLeft);
Gizmos.DrawLine (upperLeft, upperRight);
Gizmos.DrawLine (upperRight, lowerRight);
Gizmos.DrawLine (lowerRight, lowerLeft);
}

I just put that debug line in there. I’m not seeing any output in the console.


A couple of matters that might be complicating things. I’m using Windows 7 Pro on a 64-bit machine. My SP’s, etc. are all up to date.

Thanks,
Rob

I am experiencing the same problem. It seems that for some reason, OnDrawGizmos never gets called in Windows7 x64. Has this already been reported as a bug? Has anyone found a workaround?