Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How do you force redraw?

Discussion in 'Editor & General Support' started by Sundar, Mar 1, 2009.

  1. Sundar

    Sundar

    Joined:
    Mar 1, 2009
    Posts:
    21
    How do you force redraw on Scene window? As some of my debug draw lines are visible even after commenting them.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    This is probably if anything a recompile issue, rather than a redraw issue. Are there any errors in the console? You could also try reimporting the script in question.
     
  3. Sundar

    Sundar

    Joined:
    Mar 1, 2009
    Posts:
    21
    No problem with compilation, added several codes, all are working fine.
     
  4. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    If you move something in the scene, or set an object's position (even just to its current position), that seems to invalidate the scene view so Debug lines are cleaned up.

    Not positive if the object you are moving has to be within the scene view camera's frustrum or not.

    Also toggling effects for the scene window manually (little button on the top edge of it) can sometimes work.

    -Jeremy
     
  5. Omega

    Omega

    Joined:
    Jul 31, 2007
    Posts:
    125
    Whenever I update my Debug or Gizmo code, I find that all the widgets, such as camera, lights, and Gizmos, in the scene view disappear, for some reason, until I change my selection.

    After that, check for error messages. The way Unity works, it refuses to do most tasks, even adding scripts to objects, until the error(s) are resolved, at least the last time I checked. I think it has do do with how Mono compiles everything at once. Apparently one bad script ruins the barrel.

    If all else fails, I have seen Unity simply not recompile a script, normally with an error message that won't go away. The fix to this is to adjust the script, I normally delete a semicolon, to force Unity to recompile the script. After Unity acknowledges the error, fix it and resave. That clears any sticky compilation. Simply reimporting the script might also work, but I like the feel of vengeance that comes with intentionally inducing a syntax error. :wink:

    Hope it helps.
     
  6. Gordon-Anything-World

    Gordon-Anything-World

    Joined:
    Nov 9, 2010
    Posts:
    2
    I had a similar issue, being unable to force redraw Debug.DrawLine calls via scripting. They would just draw on top of each other rather than clear and redraw as they do using the editor.

    Solution was to translate the GameObject in question by nothing to force a redraw:

    transform.Translate(new Vector3(0,0,0));
     
  7. kirpigiller

    kirpigiller

    Joined:
    Jun 1, 2011
    Posts:
    7
    Thanks a lot.
    I had the same problem. Your solution works good ;)