Toggle wireframe on selected objects

Maybe this is quite obvious, but I couldn’t find an option to turn wireframe off on objects that are selected - where do I do this?

Currently, I cannot see what I am doing (especially when tweaking shaders/material parameters) due to the fact that the mesh is fairly dense and the wireframe is simply obscuring the view.

Any idea?

There isn’t an option to turn off the wireframe for an object while it is selected.

this would be very handy… as mention by the OP, working on shaders when you have a solid wireframe overlayed is very frustrating at times, and no you can’t unselect it, you often want to move/rotate the object…

perhaps provide some options here?

transparent overlay color when selected
bounding volume only
a transparency option on the wireframe

Wireframe rendering does not support transparency at all (its a hardware feature), so at least that option is “directly out”

it is possible :slight_smile:
I’ve used it on plenty of editor tools at the directX level - you just enable alphablending when you submit the drawprimitive containing the wire

…eitherway, some options as to how the selected obejcts are displayed would be handy!

problem is that unity is an opengl - dx thing not a dx thing :wink:
but yeah you are right one could change the color of the vertices

but it would also become more costly so cases where you “flooded the view” with triangles will not needfully become any better, just slower.

what I think would be a good solution would be hotkey that allows you to disable the selection overlay completely till you hit it again so you can select and see all fine and when you need to see the actual model its a hit - check - hit again

yeah a hotkey to show/hide the wireframe while working on a selected object would be nice.

Other solutions:

  • Object outline (not sure if this would be possible tho’ ;))
  • Show wireframe of the bounding volume instead

Another thing that would be good. Render wireframe as quads/tris (not just tris).

the model is triangulated (as in all realtime 3D engines, as they all work with triangles on the meshes only)

Not perfect, but certainly a workaround:

using UnityEngine;
using System.Collections.Generic;

[ExecuteInEditMode]
public class ObjectHandle : MonoBehaviour 
{
	public Transform	target;
	void Update () 
	{
		if (target != null)
		{
			if (renderer == null)
			{
				gameObject.AddComponent<MeshRenderer>();
				List<Material> list = new List<Material>();
				Renderer[] rens = target.GetComponentsInChildren<Renderer>();
				foreach (Renderer r in rens)
					foreach (Material m in r.sharedMaterials)
						if (!list.Contains(m))
							list.Add(m);
				renderer.sharedMaterials = list.ToArray();
			}
			target.position = transform.position;
			target.rotation = transform.rotation;	
		}
	}
}

Place this script on an empty GameObject and link the object you’re testing the shader on in the “target” variable. You can then rotate and move the object without seeing the wireframe, by rotating/moving the helper GameObject with the script instead.

You could even add a renderer to the helper GameObject and link in all the sharedMaterials from the target object. That way you could even edit shader settings from the helper object.

EDIT: I went around and added the material edit support. It’s actually quite handy, as it can now also be used to edit all the materials in a deep selection of objects from one single node (and without wireframes, ofcourse :P).

Awesome, thanks dude! :smile:

3 years later and still no way to disable wireframe on selected object… sigh

Not sure when this was added but as of 4.2.0f4 you can turn the alpha all the way down on your wireframe display in Preferences.

Edit > Preferences > Colors > Wireframe Active >

1368035--68558--$hide_wireframe.png

Move the (A)lpha slider all the way to the left.

You’ll notice my shitty helmet is selected and the rotate gizmo is active.

Not sure when this was added but I found this by accident when snooping through UnityEditor.dll with redgate looking for something unrelated.

2 Likes

Unity 5.4 “Edit > Preferences > Colors > Wireframe Active >”
does not seem to be working.

1 Like

Yes, I’m also had the same problem. like…
2751931--198528--Screenshot (279).png

Is there any way to turn off this wireframes?

I took the Editor script that @testure linked to and modified it so that it will enable or disable the wireframes on the renderers of all children of the selected object. I found this makes it much more useful, at least for me. Also changed the keyboard shortcut for Show Wireframe to Ctrl+w, as the example script had it set to Ctrl+s, which is already used (save scene).

using UnityEngine;
using UnityEditor;

namespace YourGame
{   
    public class ToggleWireframe : EditorWindow
    {
        [MenuItem("GameObject/Show Wireframe %w")]
        static void ShowWireframe()
        {
            foreach (GameObject s in Selection.gameObjects)
            {
                var renderers = s.GetComponentsInChildren<Renderer>();
                if (renderers == null) { return; }

                foreach (var r in renderers)
                {                   
                    EditorUtility.SetSelectedWireframeHidden(r, false);
                }               
            }
        }

        [MenuItem("GameObject/Show Wireframe %w", true)]
        static bool ShowWireframeValidate()
        {
            return Selection.activeGameObject != null;
        }

        [MenuItem("GameObject/Hide WireFrame %h")]
        static void HideWireframe()
        {
            foreach (GameObject s in Selection.gameObjects)
            {
                var renderers = s.GetComponentsInChildren<Renderer>();
                if (renderers == null) { return; }
               
                foreach (var r in renderers)
                {
                    EditorUtility.SetSelectedWireframeHidden(r, true);
                }                           
            }
        }


        [MenuItem("GameObject/Hide WireFrame %h", true)]
        static bool HideWireframeValidate()
        {
            return Selection.activeGameObject != null;
        }
    }
}
3 Likes

Thank you! It is working great. To make sure everyone gets it, here are the fail-safe instructions: put above script named toggleWireframe.cs in an editor folder, use Ctrl+h to hide wireframe of selected mesh, Crtl+w to unhide.

1 Like

THANKS – You’ve helped me out today :slight_smile:

However, The wireframe, after I make it hidden, doesn’t disappear until I select the object again. Any idea how to force the scene view to update the change?

1 Like

@infinitypbr - sorry, I can’t help you there as it disappears immediately for me. :slight_smile:

I’m not super knowledgeable about editor scripting just yet, so I’m not sure how to do that.

I do find that it reappears after running the game though.

Interesting. My best amateurish guess is that the scene view doesn’t register any changes, so it doesn’t update. Only updates when a change occurs, probably. Who knows!

(It’s an update for the Blend Shapes script – the Devils character has 175 blend shapes, so I’m updating the script to make things more readable, to turn off the wireframes, and to have preset files that you can export and import)

1 Like