Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
fpsarmedunity

disable multiple skin mesh renderer at once

Question

Hi I'm working on my ecamine system for my project an all works fine but i have a little issue

 when examininig object i want examned object renderer to be disabled and i figured this with this line of code

Please login or register to see this code.

and renenable it after examination with

 

Please login or register to see this code.

 and all works as ecpected but my probme is that  my  weapons object have many  meshes and not a single mesh renderer

 

it tried  with GetComponentsInChildren but only the first skinned mesh is disabled for thie gameobject ...how can i solve this?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1

show us code you used with GetComponentsInChildren.

 

Personally i wouldn't use GetComponentsInChildren, if it will be used often.

  • Like 1

Share this post


Link to post
Share on other sites

  • 0

if you put all optics under one child you can completely disable the optics object and enable it again so all childern get disabled as well with it. 

 

Share this post


Link to post
Share on other sites
  • 0

hi and thanks to both but i solved by myslf with this

Please login or register to see this code.

where "_currentObject" is the Gameobject  that contains the skinned meshes

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...