Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug 2022.2.0b7 - Handles.DrawWireCube not respecting Handles.color

Discussion in '2022.2 Beta' started by adamgolden, Sep 9, 2022.

  1. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,283
    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).

    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:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using UnityEngine;
    3. using UnityEditor;
    4. public class ExampleDrawWireCubeColorBroken : MonoBehaviour
    5. {
    6.   private void OnDrawGizmos()
    7.   {
    8.     MeshFilter mf = GetComponent<MeshFilter>();
    9.     Handles.matrix = transform.localToWorldMatrix;
    10.     Mesh mesh = mf.sharedMesh;
    11.  
    12.     Handles.color = Color.red;
    13.  
    14.     Handles.DrawWireCube(mesh.bounds.center, mesh.bounds.size);
    15.     Handles.DrawWireDisc(mesh.bounds.center, Vector3.up, Mathf.Max(mesh.bounds.size.x, mesh.bounds.size.z) * 0.5f);
    16.   }
    17. }
    18. #endif
     
  2. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    243
    Just came across this is 2022.1.16!
     
  3. killo0o

    killo0o

    Joined:
    Jan 7, 2017
    Posts:
    2
    Confirming issue stays on 2022.1.23f1
     
  4. Talimar

    Talimar

    Joined:
    Dec 28, 2012
    Posts:
    3
    Found this post because it's not working for me either... 2022.1.23f1