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 doomprodigy · Dec 20, 2011 at 12:13 AM · materialenablemeshrenderer

MeshRender Enabling.

I have been searching a little while to see if this is possible but have come up with nothing. Aside from Enabling and disabling the whole component on the GameObject.

Is there a way to enable and disable Various Elements in a MeshRender on a GameObject by script. For instance Enabling Element 1 and disabling all other elements.

Thank you for your time.

(Also could say I want to enable and disable a lot of materials on one object.)

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
2
Best Answer

Answer by Zergling103 · Dec 20, 2011 at 01:11 AM

So you want to disable the rendering of submeshes?

Meshes usually contain multiple materials, and for each material there is a submesh to go with it. (The technical reason for this is you cannot switch materials in one render call, and each render call should recieve all the mesh data to be rendered with that material. So its stored in a submesh and sent individually.)

Sometimes when you import a mesh, it is stored as a prefab with the submeshes stored as children of that prefab. Each child will have it's own MeshRenderer. You can disable that. Otherwise you might be able to drag out individual submeshes from the prefab and initialize them separately, giving each it's own renderer which you can disable.

If they cannot be separated then as far as I am aware you cannot disable submesh rendering individually. The model will have to be re-exported per material.

If the mesh is skinned, then I'd recommend finding a work-around that doesn't require disabling per-material rendering.

I cannot recommend writing a shader that renders the object as fully transparent as an alternative to disabling the render altogether as this is very amateurish and a waste of rendering power.

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 doomprodigy · Dec 20, 2011 at 03:39 AM 0
Share

Both of your answer worked. After reading what Lo0Hnuit$$anonymous$$ linked I managed to work out what I wanted to do. And I do appreciate your detailed explanation and answer Zergling. Thanks

avatar image
2

Answer by Lo0NuhtiK · Dec 20, 2011 at 12:40 AM

Material

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 doomprodigy · Dec 20, 2011 at 03:40 AM 0
Share

Thank you.

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

6 People are following this question.

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

Related Questions

Fade an object in and out 0 Answers

Why isn't the color changing? 1 Answer

Disable Meshrenderer OnTriggerEnter 0 Answers

How to make a cube with metallic look and soft edges [pic included] 1 Answer

Material Instance Created in Car Model Prefab 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