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.
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
it is possible
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
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
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).
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;
}
}
}
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.
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?
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)