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
0
Question by caesarpena · May 16, 2016 at 09:08 PM · scripting problemmeshmeshfilterattribute3dmodel

Hi, It is possible to get all the attributes inside a mesh with an script

Hi, i have a project in unity in which i imported a 3D model, the same comes with some basic information of every component of the model.. in unity avery object has a mesh and all the attributes are stored inside that mesh.

the question is it is possible get the meshed of an object and store and then retrieve these attributes?

i currently have this code, looks logical for me but i'm lost in the last step, idk if this is even possible.

     public MeshFilter canmesh;
     public GameObject can;
     void Start()
     {
         //if (can == null)
             can = GameObject.FindWithTag("can");

       canmesh = can.GetComponent<MeshFilter>();

     Debug.Log("CAN MESH", canmesh);
 }
 

find attached a picture of the mesh attributes in UI

im trying to get locate the object - get inside the filter mesh and then print it, lol

any help?alt text

Thanks,

mesh-attributes.png (4.1 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

1 Reply

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

Answer by Bunny83 · May 16, 2016 at 09:46 PM

Your question is very confusing as it's not clear what you mean by attributes and where they are actually stored. If you just talk about the file name / name of the mesh of the imported model you can do:

 MeshFilter mf = can.GetComponent<MeshFilter>();
 Mesh mesh = mf.sharedMesh;
 Debug.Log("MeshName: " + mesh.name);

If you talk about other attributes, you should be more clear what you mean and where they are stored / defined.

Comment
Add comment · Show 3 · 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 caesarpena · May 17, 2016 at 12:36 PM 0
Share

basically what i want to do is get this attributes as strings

please refer to the image bellow.

alt text

meshf.png (16.3 kB)
avatar image caesarpena · May 17, 2016 at 01:00 PM 0
Share

Hi @Bunny83 thanks for your answer, i have a 3d model imported into unity, each of the objects of the model has its own set of attributes which some of them are getting into the mesh when imported to unity, refer to the image, there name of an object and ID inside the mesh... what i want to know is can i get those attributes with code?

Thanks.

avatar image Bunny83 caesarpena · May 18, 2016 at 03:14 AM 0
Share

Well, if you indeed talk about the name of the mesh, you can use what i posted in my answer above. The other things are not "attributes" but assigned materials. The materials don't belong to the $$anonymous$$esh or the $$anonymous$$eshFilter component, but the $$anonymous$$eshRenderer component which is responsible for rendering the $$anonymous$$esh.

To get the materials list you can do this:

 $$anonymous$$eshRenderer renderer = GetComponent<$$anonymous$$eshRenderer>();
 $$anonymous$$aterial[] mats = renderer.shared$$anonymous$$aterials;
 foreach (var mat in mats)
 {
     Debug.Log("$$anonymous$$aterial name: " + mat.name);
 }

If you need any more help you should be more precise for what you need that information.

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

Creating 3D shapes by given coordinates 0 Answers

Why vertex positions appear (0.0, 0.0, 0.0) ? 1 Answer

Using MeshFilter.mesh with static ground plane makes object turn into a plane. 0 Answers

How to get deform information from animating character's mesh 1 Answer

Copying a mesh filter component through script. 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