Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by WalkupAndAway · Dec 21, 2016 at 07:32 AM · mesherror messagecombinecombinemeshes

CombineMeshes Error on Run-time Meshes

I'm attempting to combine the meshes of a few Game Objects generated at run-time. The meshes are generated with Leap Motion's Pinch Draw script. This is the function I'm using to combine them:

     void MergeLineObjects()
     {
         GameObject noteContainer = GameObject.FindWithTag("AnnotationContainer");
         MeshFilter[] meshFilters = noteContainer.GetComponentsInChildren<MeshFilter>();
         Mesh finalMesh = new Mesh();
         CombineInstance[] combineInstances = new CombineInstance[meshFilters.Length];
 
         for(int i = 0; i < meshFilters.Length; i++)
         {
             meshFilters[i].sharedMesh.Optimize(); //Might not do anything
             combineInstances[i].subMeshIndex = 0;
             combineInstances[i].mesh = meshFilters[i].sharedMesh;
             combineInstances[i].transform = meshFilters[i].transform.localToWorldMatrix;
         }
 
         finalMesh.CombineMeshes(combineInstances); // Getting error: Cannot combine mesh that does not allow access: Line Mesh
         meshFilters[0].sharedMesh = finalMesh;
         meshFilters[0].gameObject.SetActive(true);
     }
 }

When running this, I get the error: Cannot combine mesh that does not allow access: Line Mesh

None of the mesh objects are static, and my function is basically following the example for CombineMeshes() in the Unity Documentation. Has anyone else run into this?

Thank you!

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

2 Replies

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

Answer by WalkupAndAway · Jan 11, 2017 at 10:38 PM

Solved this!

Within Leap Motion's Pinch Draw script, there is a function called FinishLine() that completes the generation of the user-drawn mesh. Within that function, they used the mesh function UploadMeshData() with the parameter 'markNoLongerReadable' set to 'true', meaning that data could not be read from the mesh after it was created.

This was preventing the meshes from being combined, and simply changing the value of the 'markNoLongerReadable' parameter to 'false' fixed the issue!

The code before:

 public void FinishLine() {
         _mesh.Optimize();
         _mesh.UploadMeshData(true);
       }

The code after:

 public void FinishLine() {
         _mesh.Optimize();
         _mesh.UploadMeshData(false);
       }

Easy as that!

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 unity_l3Ac7R_V3zAEkQ · Nov 20, 2018 at 05:00 AM

where i can call FinishLine() Function . Please Explain Clearly.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

CombineMeshes() Not Working Properly? 0 Answers

Assertion failed on expression: '(int)lastVertex < GetVertexCount()' 1 Answer

Drawcalls vs MeshCombiners 1 Answer

CombineMeshes not working on one machine but is on another 1 Answer

Combining meshes clears old mesh 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