Search Unity

OnDrawGizmos' not working in prefab edit mode?

Discussion in 'Prefabs' started by Prodigga, Oct 9, 2018.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Title. :) I see the gizmos in the scene view, but if I open up the same prefab in prefab edit mode, I don't see the gizmos.
     
    ymx_xd likes this.
  2. hunterofakara

    hunterofakara

    Joined:
    Oct 4, 2018
    Posts:
    21
    Gizmos.DrawWireCube is showing for me in prefab mode (Checked with regular gameobject, not a canvas one).
    A specific function not working for you, or possibly some position variable not being initialized the same?
     
  3. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Whoops! I apologise, I wasn't using Gizmos.Draw, I was using Debug.DrawLine inside of OnDrawGizmos. (Can't draw lines with gizmos)

    So, I guess the question is are Debug.DrawLines supposed to work in Prefab Mode?
     
  4. hunterofakara

    hunterofakara

    Joined:
    Oct 4, 2018
    Posts:
    21
    Ah okay, I'm getting the same as you.
    The documentation says "The line will also be drawn in the Scene when it is visible in the Game view."
    Since game view doesn't load/render the prefab mode, I guess the debug line is never copied to the scene view.

    It goes on to suggest using Gizmos.Drawline or Handles.DrawLine instead for editor gizmos - Maybe you'd be able to temporarily use one of those just for viewing in prefab mode?
     
  5. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    219
    Debug.DrawLine is not supported in Prefab Mode, they will always render with the main scenes