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 Ribboninju · Jun 25, 2012 at 07:37 PM · meshmeshfilterdisappeardisappearing

Mesh Disappears simply by mentioning it in a script

Quickest way to produce the problem in c#:

 using UnityEngine;
 using System.Collections;
 
 public class asdf : MonoBehaviour
 {
     public GameObject thing;
     void Start()
     {
         Debug.Log (thing.GetComponent<MeshFilter>().mesh); //Look at your debug window in unity
     }
 }

REMEMBER to name it asdf.cs AND to assign the script a model AND to place the script on a model.

The problem: play the game. Now quit it. The mesh disappears from mesh filter.

REMEMBER to reimport the model to test again.

Important Details: Hit play after reimporting, and click on your model inside the project panel. In the inspector, scroll down where you see the tab "Imported Object" and look at the mesh filter, the mesh has became "Type misMatch".

I tried my best make this as detailed yet short as possible, if you request that I get more information please tell me. (and how, if needed , since I'm a beginner)

EDIT: I am using Mac OSX 10.6.8 and I am using Unity version 3.5.2f2.

Comment
Add comment · Show 4
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 DaveA · Jun 25, 2012 at 08:11 PM 0
Share

Sounds like should be a bug report. I assume you have tried $$anonymous$$eshFilter meshFilter = thing.GetComponent\<$$anonymous$$eshFilter\>(); Debug.Log(meshFilter.mesh); which may give different results. Not really sure what mesh 'to string' will do.....

avatar image Ribboninju · Jun 25, 2012 at 08:29 PM 0
Share

I will look into it more later, but I found that one could cheaply hack by adding the mesh as a public variable, and assigning it to the model. thing.GetComponent<$$anonymous$$eshFilter>().mesh = publicmesh;

What a very weird problem, I might have to bug report it if the things you said gave the same result.

The fact that the compiler doesn't complain about the "Type mis$$anonymous$$atch" scares me.

EDIT: gosh, just merely mentioning the string makes it lose the mesh. Looks like I might have to report a bug.

avatar image Eric5h5 · Jun 25, 2012 at 08:54 PM 0
Share

1) What type mismatch? 2) I followed your steps and the mesh does not disappear.

avatar image Ribboninju · Jun 25, 2012 at 08:56 PM 0
Share

Could be an issue special to my computer. I am using $$anonymous$$ac OSX 10.6.8, But if there's anything more I could say let me know.

If it produced the bug, where it would say the name of the mesh with a circle on the right (like cube or plane), it would turn into "Type mis$$anonymous$$atch"

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Ribboninju · Jun 25, 2012 at 09:08 PM

SOLUTION: create a public Mesh of that model and assign it to the model.

SCRIPT:

 using UnityEngine;
 using System.Collections;
 
 public class asdf : MonoBehaviour
 {
     public GameObject thing;
     public Mesh thingy;
     void Start()
     {
         Debug.Log (thing);
         Debug.Log (thingy);
         
         thing.GetComponent<MeshFilter>().mesh = thingy;
     }
 }

Now you can never lose the mesh, however this is more of a workaround of a bug that should be reported than a solution.

Comment
Add comment · Show 1 · 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 Agostino · Nov 19, 2013 at 11:43 AM 0
Share

So, have you reported this bug? I faced the same thing on Windows 7 using Unity 4.2.2. I guess it's still there, unsolved.

avatar image
0

Answer by SantiMuffin · Aug 10, 2012 at 08:42 PM

I got this same problem. Couldn't figure out the why, but found a different work around. If you are not going to be modifying the mesh you can use something like.

 MeshFilter mapMesh = gameObject.GetComponent<MeshFilter>();
 Debug.Log(mapMesh.sharedMesh);

With the sharedMesh you are calling the actual Mesh(mother) and not the instantiated shape(daughter).

Just remember that if you modify this sharedMesh all of the objects that use it will be modified as well. Check the documentation for more info :)

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Finding flat, horizontal regions for reliable object placement? 0 Answers

Is it possible to make vertices defined by a mesh and mesh filters animating? 0 Answers

How to prevent editor to set the scene dirty if a script changes a mesh (@ExecuteInEditMode) 1 Answer

Generate a highpoly sphere with mesh collider procedurally 2 Answers

Mesh Filters randomly self deleted 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