Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: wheretheidivides on April 05, 2015, 02:47:36 PM

Title: How do you set material color of prefab?
Post by: wheretheidivides on April 05, 2015, 02:47:36 PM
So I have a tank prefab with child objects.  They in turn have child objects which have materials.  I wish to change the color of the grandchildren and below.  In the project folder you can only see the parent and the 1st level child.  So you can't see the grandchild unless you put it in the hierarchy.  So how would you do this?

I want to change the color of the material of the grandchild to 0,200,0 (from the standard 150,150,150) which is green.  That way each player can have a different color when playing in team mode.
Title: Re: How do you set material color of prefab?
Post by: Splankton on April 07, 2015, 12:17:29 PM
You have to get a reference of the gameobjects that have the material you want to change.  So you could use find child to store the gameobject variable.  Now you have the reference,  you will be able to set the material color.  Hope that helps. 
Title: Re: How do you set material color of prefab?
Post by: wheretheidivides on April 07, 2015, 01:23:21 PM
I see.  Thanks.