Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 this with option(s) in Unity3D or do i have to code it myself ?

If i actually have to code it myself, this 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 thing in game mode that in scene mode.

Picture

Thx you for your futur answers,

Ps : Sorry for my bad english, this 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 which 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 this script to your object.

After, that you don't have to do anything else.

The only things 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 this thread while trying to solve this myself, and while 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 this 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 white 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mesh triangles don't match wireframe view? 0 Answers

Rendering mesh edges in-game just as they appear in editor mode 1 Answer

Is direct MeshRenderer vertex mutation (or dynamic Mesh building) possible? 2 Answers

Wireframe Rendering? 4 Answers

Render wireframe on cut section of polygons 2 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