playMaker

Author Topic: [SOLVED]Trying to display random textures on a cube  (Read 5204 times)

dbt

  • Playmaker Newbie
  • *
  • Posts: 6
[SOLVED]Trying to display random textures on a cube
« on: September 13, 2012, 04:00:06 AM »
Howdy,

First off... I am new to Unity, Playmaker and ArrayMaker.

Task: Display random colors on a cube as a learning exercise.

Setup Objects and sundries::

a. Create cube via Game Object tab

b. Created Empty game object renamed ColorArrayList and added Playmaker Array ListProxy (script. configured as...

PrefillData:
   Prefill type: Texture
   Prefill count: 16
   small thumbs: checked
   Live update: checked
   set of 16 colors textures,

I imported png files into the materials folder under the "project tab" in unity all colors are visible under the Inspector's tab in unity.

c. Create variable: randomVariable
d. Create event: eventLoopEndlessly
[=> e. create texture variable: MyColorVariable]


The Program in a fsm for the cube object:

1.  I used the  "Random Int" Playmaker action and stored the generated value into randomVariable.

2. I used the  "Array List Get" action with randomVariable placed in the "Get Texture data" slot....

Game Object: Specify Game Object
      ColorArrayList
Reference:   None
At Index:    RandomVariable
.
.
.

Get Texture:   randomVariable [=> should be MyColorVariable]


3. I used "Set Material Texture" Playmaker Action with...

Game Object: User Owner
Material Index: None

Material    None (Material)
Named Texture:  _MainTex
Texture:     MyColorVariable

4. After step 3, I send an event, eventLoopEndlessly with a 5 second delay back to the fsm itself.




Issue:

When I run the program I can see the random numbers being generated and
the randomVariable changing in the ArrayListGet Action but the texture slot is not changing. It stuck at "none"

And no color show on my cube.


I'm not sure if am using the Set Material Texture Action properly.



Any help or pointers would be much appreciated.

TIA


dbt

« Last Edit: September 18, 2012, 02:19:05 AM by dbt »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Trying to display random textures on a cube
« Reply #1 on: September 13, 2012, 05:41:03 AM »
Hi,

 Can you confirm that you studied the "GameObjectPositioning" sample available in ArrayMaker Package?

 Are you sure that you are referencing the material on the cube you are observing? it's likely a problem of reference I feel.

can you see the texture reference changing as well?

in your description, something is wrong, you are injecting the fsm variable "MyColorVariable" into a texture, surely you should instead have a "MyTextureVariable" here.

bye,

 Jean

dbt

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Trying to display random textures on a cube
« Reply #2 on: September 13, 2012, 08:00:48 AM »
thx for that quick response.... had no sleep yet ... :-)

No.. I have not studied the GameObjectPositioning yet... I will do that...

I will check my description of the problem.... (typed it with one eye open.. could be my error typing)


I will post after looking at the pointers you supplied and I getting some sleep.

Thanks again!

dbt



dbt

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Trying to display random textures on a cube
« Reply #3 on: September 13, 2012, 04:00:54 PM »
Hello Jean,

Answers to your questions:

 Can you confirm that you studied the "GameObjectPositioning" sample available in ArrayMaker Package?

       ANS: Have reviewed this sample.



 Are you sure that you are referencing the material on the cube you are observing? it's likely a problem of reference I feel.

   ANS: I don't know, I'm using the default for "Set Material Texture" action see (3) in my orginal question. I also think it's a reference problem too. I still don't understand Material vs texture.
   

can you see the texture reference changing as well?
   ANS: No reference changing, stays "None"

in your description, something is wrong, you are injecting the fsm variable "MyColorVariable" into a texture, surely you should instead have a "MyTextureVariable" here.

   ANS: See my corrections for MyColorVariable, it is declared a texture. setup section (e)


Thanks again...
dbt

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Trying to display random textures on a cube
« Reply #4 on: September 15, 2012, 04:49:24 AM »
Hi,

 I know... it's because there is a bug in the get action.

 Please download and replace the two attached files of this thread:

http://hutonggames.com/playmakerforum/index.php?topic=1199.msg5018#msg5018

you will then be able to correctly get a texture from an arrayList,

sorry for the trouble,

 Jean

dbt

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Trying to display random textures on a cube
« Reply #5 on: September 16, 2012, 02:14:15 PM »
thx Jean,

Works like a charm.... u do that voodo that u do so well  ::)

Keep up the good work!

I'm guessing that the new get action will be integrated in an upcoming release...  ;D


dbt
« Last Edit: September 16, 2012, 02:16:36 PM by dbt »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Trying to display random textures on a cube
« Reply #6 on: September 17, 2012, 03:33:15 AM »
hi,

yes, i mean to make an update it for months now... simply carried away with other things...

bye,

jean