• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ReCoF · Apr 09, 2015 at 04:41 PM · meshingamewireframe

How to see mesh in game mode ?

Hello everyone,

I'd like to see the mesh in-game mode,

I mean, i'd like to see exactly what i see when i'm overviewing my scene in ShadedWireframe mode, but in the game mode.

Is it possible to do t$$anonymous$$s with option(s) in Unity3D or do i have to code it myself ?

If i actually have to code it myself, t$$anonymous$$s is not a problem, but can you give me some tips because i have no idea about the path to follow.

Here is a picture about what i see in my scene mode and i my game mode, and i'd like to see the same t$$anonymous$$ng in game mode that in scene mode.

Picture

Thx you for your futur answers,

Ps : Sorry for my bad english, t$$anonymous$$s isn't my native langage.

capture-decran-2015-04-09-a-090740.png (227.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by ReCoF · Apr 10, 2015 at 12:25 PM

Thank you for you answer !

Actually, i find the solution right before you answered me.

So in order to help people w$$anonymous$$ch the same problem than me, here is the solution : I created the following script : "ShadedWireframe"

 public class ShadedWireframe : MonoBehaviour {
 
     void OnPreRender() {
         GL.wireframe = true;
     }
     void OnPostRender() {
         GL.wireframe = false;
     }
 }

And you have to associate it to the camera.

Be careful, because it doesn't work if you associate t$$anonymous$$s script to your object.

After, that you don't have to do anyt$$anonymous$$ng else.

The only t$$anonymous$$ngs that can be a little bit annoying is the fact that you also see the mesh of the skybox.

I hope it will help someone.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by chmodseven · Oct 12, 2018 at 09:22 AM

I came across t$$anonymous$$s thread w$$anonymous$$le trying to solve t$$anonymous$$s myself, and w$$anonymous$$le the solution works well the first time you apply it, I wanted it to be toggleable and ran into an issue where wireframe mode would not display properly after the first time. Eventually I solved it, so here's a toggleable version (press "Z", in t$$anonymous$$s example, or alter the isInWireframeMode variable in the Inspector or via code) that might help someone else down the track.

It doesn't need two cameras or depth setting hacks like other solutions I've seen - just attach to the regular camera. You can set your own preferred background color for the wireframe mode in the inspector if you don't want black, although the w$$anonymous$$te for the foreground lines apparently can't be changed without digging into GL code more extensively. Enjoy!

 using UnityEngine;
 
 [RequireComponent (typeof (Camera))]
 public class WireframeViewer : MonoBehaviour
 {
     public Color wireframeBackgroundColor = Color.black;
     public bool isInWireframeMode;
     private Camera cam;
     private CameraClearFlags origCameraClearFlags;
     private Color origBackgroundColor;
     private bool previousMode;
 
     private void Start ()
     {
         cam = GetComponent<Camera> ();
         origCameraClearFlags = cam.clearFlags;
         origBackgroundColor = cam.backgroundColor;
         previousMode = isInWireframeMode;
     }
 
     private void Update ()
     {
         if (Input.GetKeyDown (KeyCode.Z))
         {
             isInWireframeMode = !isInWireframeMode;
         }
 
         if (isInWireframeMode == previousMode)
         {
             return;
         }
 
         previousMode = isInWireframeMode;
         if (isInWireframeMode)
         {
             origCameraClearFlags = cam.clearFlags;
             origBackgroundColor = cam.backgroundColor;
             cam.clearFlags = CameraClearFlags.Color;
             cam.backgroundColor = wireframeBackgroundColor;
         }
         else
         {
             cam.clearFlags = origCameraClearFlags;
             cam.backgroundColor = origBackgroundColor;
         }
     }
 
     private void OnPreRender ()
     {
         if (isInWireframeMode)
         {
             GL.wireframe = true;
         }
     }
 
     private void OnPostRender ()
     {
         if (isInWireframeMode)
         {
             GL.wireframe = false;
         }
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Cherno · Apr 09, 2015 at 04:53 PM

You need a wireframe shader for that. Google is your friend :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Create a Wireframe Shader with Shader Forge 1 Answer

Missing shaded wireframe option in unity 2019.1.3f,shaded wireframe not showing(LWRP) unity 2019.1.3f 1 Answer

Green Wireframe Length 1 Answer

Wireframe material overlapping with mesh 0 Answers

Mesh triangles don't match wireframe view? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges