playMaker

Author Topic: Easiest way to set a random (but unused) material?  (Read 1968 times)

AKindChap

  • Playmaker Newbie
  • *
  • Posts: 6
Easiest way to set a random (but unused) material?
« on: January 29, 2015, 02:33:24 PM »
Hello.

I have 10 boxes. I want to give each of them a random material, but they all have to be different...

If 1 box is green, the other 9 can't be green. What would be a good way to do this?

Thanks.

blackant

  • Hero Member
  • *****
  • Posts: 525
  • http://blackantmaster.com
    • blackantmaster.com
Re: Easiest way to set a random (but unused) material?
« Reply #1 on: January 30, 2015, 01:58:32 AM »
use an array list referencing all your colors or material
then use  a loop to assign your objects unique array ID


AKindChap

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Easiest way to set a random (but unused) material?
« Reply #2 on: January 31, 2015, 10:08:41 AM »
Thanks for the reply. I did figure out a way to do this... but I'm almost definitely sure it's not the right/most efficient way.

I made it so that 1 box picks a colour, then deletes the option from the array, then the 2nd box waits, then picks a colour, then deletes it from the array, 3rd box waits longer etc.

What do you mean by loop? Thanks.