2022.2.0b7 - Handles.DrawWireCube not respecting Handles.color

I’m not sure how long this bug has existed, but I noticed it in the latest beta.

Setting Handles.color does not work for Handles.DrawWireCube. It does for other things (as shown with DrawWireDisc).

8427612--1115634--Handles_DrawWireCube_color_issue.jpg

The repro below uses OnDrawGizmos, but I noticed this in a custom editor drawing in OnSceneGUI. Add to any GameObject with a MeshFilter and mesh:

#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
public class ExampleDrawWireCubeColorBroken : MonoBehaviour
{
  private void OnDrawGizmos()
  {
    MeshFilter mf = GetComponent<MeshFilter>();
    Handles.matrix = transform.localToWorldMatrix;
    Mesh mesh = mf.sharedMesh;

    Handles.color = Color.red;

    Handles.DrawWireCube(mesh.bounds.center, mesh.bounds.size);
    Handles.DrawWireDisc(mesh.bounds.center, Vector3.up, Mathf.Max(mesh.bounds.size.x, mesh.bounds.size.z) * 0.5f);
  }
}
#endif
4 Likes

Just came across this is 2022.1.16!

Confirming issue stays on 2022.1.23f1

Found this post because it’s not working for me either… 2022.1.23f1

yep, the same here on 2022.1.23f1

I’ve submitted a bug for this, FYI.

1 Like

It’s been fixed :smile:
https://issuetracker.unity3d.com/issues/object-with-the-wrong-color-is-drawn-when-using-the-handles-dot-drawwirecube-and-handles-dot-color-functions

1 Like