• 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 1dayitwillmake · May 10, 2013 at 11:05 PM · meshdynamicmeshfilter

Multiple MeshFilters for a GameObject

I have a Ribbon object, which I am creating dynamically and appending quads to it's mesh each frame. In order for it to remain visible as it twist due to backface-culling I have to have two meshes one with the normals facing one direction, and one with the normals facing the opposite direction (front/back).

Is it possible to have two meshes for one game object?

Here's how the mesh is created for reference: mesh = new Mesh(); filter = GetComponent(); filter.mesh = mesh;

             vertices = new Vector3[ len * 4 ];
             vertices[0] = new Vector3(0, 0, 0);
             vertices[1] = new Vector3(width, 0, 0);
             vertices[2] = new Vector3(0, height, 0);
             vertices[3] = new Vector3(width, height, 0);
             mesh.vertices = vertices;
             
             // Create two triangles pointing using the vertices array index positions
             triangles = new int[ len * 6 ];
             // 1
             triangles[0] = 0;
             triangles[1] = 2;
             triangles[2] = 1;
             // 2
             triangles[3] = 2;
             triangles[4] = 3;
             triangles[5] = 1;
             mesh.triangles = triangles;
             
             // Create the normals all pointing outward
             normals = new Vector3[ len * 4];
             normals[0] = -Vector3.forward;
             normals[1] = -Vector3.forward;
             normals[2] = -Vector3.forward;
             normals[3] = -Vector3.forward;
             mesh.normals = normals;
             
             // Create UV's at each corner
             uvs = new Vector2[ len * 4];
             uvs[0] = new Vector2(0, 0);
             uvs[1] = new Vector2(1, 0);
             uvs[2] = new Vector2(0, 1);
             uvs[3] = new Vector2(1, 1);
             mesh.uv = uvs;
Comment
Add comment · Show 5
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 Fattie · May 10, 2013 at 11:06 PM 3
Share

just have them all in one mesh. or, use submeshes if you like. or very simply (if you wanted to) have two gameObjects and group those inside another gameObject

avatar image syclamoth · Jun 04, 2013 at 05:48 AM 0
Share

Well, the simplest answer is just 'NO'. At least @Fattie is suggesting an alternative.

avatar image 1dayitwillmake · Jun 04, 2013 at 12:42 PM 0
Share

Well if you look at all the rude things @fattie was saying along with his answer, that he then removed you can understand why I would reply in such a way.

"@1day could you please TIC$$anonymous$$ ANY ANSWER HERE, TO CLOSE OUT THE QUESTION. It's yoru job as the OP. Don't hesitate to ask a new question of interest

ITS THE ROUND SY$$anonymous$$BOL -- WITH A TIC$$anonymous$$ IN THE $$anonymous$$IDDLE

cheers"

avatar image Fattie · Jun 04, 2013 at 12:48 PM 1
Share

1day, there is nothing slightly rude about that. Please note that moderators (not me, other moderators) spend sometimes hours a day helping out. Nobody was being slightly rude. Anyway be sure to TIC$$anonymous$$ answers, please don't neglectt do it, cheers!

avatar image Fattie · Jun 04, 2013 at 12:49 PM 1
Share

Of course I removed the answer -- because you said it wasn't what you wanted. That's what the remove button is for. This forum is supposed to have neat, concise correct answers in the future.

0 Replies

· Add your reply
  • Sort: 

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

18 People are following this question.

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

Related Questions

Updating Dynamic Mesh's Collider is Too Slow 1 Answer

Creating a mesh and assigning a material during edit time. 1 Answer

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


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