playMaker

Author Topic: Material name?  (Read 3086 times)

cursed1

  • Playmaker Newbie
  • *
  • Posts: 8
Material name?
« on: December 02, 2013, 08:16:34 PM »
hi
 i create 3 cube and set random material(materials =number textures)
when click cube how to get number ?
material name or different way
how to make it
please help :-[

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15602
  • Official Playmaker Support
Re: Material name?
« Reply #1 on: December 04, 2013, 05:50:17 AM »
Hi,

 several ways:

1: you can name your cubes "cube 1", "cube 2", and then when you click, you get the name of the gameobject and parse its name to know which one it was

2 ( better ), have a fsm on each of these cubes, name that fsm "cube" always with a fsm int variable called index that you expose to the inspector. drop that on all your cube and set the index properly for each one of them. . now when you click, you will get the object reference, use it in a "Get Fsm int" action and fill in the info for that fsm ( name ="cube" and the variable name too). now if you click on a gameobjec tthat has a fsm called Cube and an int called "index", then you are in. else it will return 0 and you know this was not a cube you wanted.

bye,

 Jean