Is this a bug in 2019.2.10f1 gizmos and layers?
We have a project in 2019.2.10f1 and I created a simple script that draws a wire cube gizmo:
public Vector3 Size; // Gets set to some sensible value in the editor.
...
private void OnDrawGizmos() {
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.color = Color.green;
Gizmos.DrawWireCube(Vector3.zero, Size);
}
It does nothing else other than this. I threw this script onto a game object and was surprised when it didn't draw the cube. I made sure gizmos were being drawn, all the usual things that you forget sometimes.
I even put a Debug.Log in there to make sure it was being called, and it surprised me when nothing printed to the console. In a fit of confusion I put the script on another object, and lo! it worked as expected.
I scratched my head for some time, I asked my colleagues if I was doing something daft, and no one could come up with an answer I hadn't already tried.
After a bit I noticed that the first object was on a custom layer, and the second working object was on a different custom layer. Anyway, to cut a long story short, gizmos don't draw if an object is on layer 9! Every other layer I tried, both built-in and custom work fine. It's not the name of the layer because I renamed different layers but to no effect.
I know that this version of Unity isn't LTS or cutting-edge, so I don't expect a fix for this version, but if any of you are using a different version, could you all try it out before I put in a bug report? Mostly for my own sanity because it seems like such a specific bug that I'm sure it has to be a PEBKAC.
Your answer
Follow this Question
Related Questions
Handles.ScaleHandle gizmo gui does not move? 0 Answers
Gizmo custom Icon tinted by default? 0 Answers
Gizmos and Handles 1 Answer
How to disable this kind of gizmo? 1 Answer
Suppress Transform Gizmo in Editor 0 Answers