playMaker

Author Topic: How to best make a gallery?  (Read 2321 times)

jerware

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
How to best make a gallery?
« on: June 02, 2012, 03:37:57 PM »
I'm new to Unity and have no scripting experience with the engine. I purchased PlayMaker and nGUI to help get me started.

I have an FSM that increments an INT every time the user presses a button, and then resets that INT to 0 after it reaches a set threshold. I want to change a texture on an object based on that INT, so the user can cycle through images in a gallery. I've tried Set Material and Set Material Texture, but this only seems to work with "hard coded" textures/materials set in the FSM action, and as far as I can tell would require a different node for each image. I really want some sort of texture list (whose name is perhaps a string var) where I can refer to an index, and have that texture applied to a passed object. The reason I need it this flexible is I want to use this generic FSM across multiple galleries.

Does this make any sense at all? What will I need to get this accomplished? I greatly appreciate any helpful replies. Pardon my noobness.

Jeremy

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14593
  • Official Playmaker Support
    • View Profile
Re: How to best make a gallery?
« Reply #1 on: June 04, 2012, 04:56:24 AM »
Hi,

 One way to accomplish this is to use a playMaker add on I created it exactly for this kind of cases, ArrayMaker:

https://hutonggames.fogbugz.com/default.asp?W715

So you would create a new arrayList or hashtable ( if you want to reference your texture with strings instead of with ints for example). Add your textures during editing OR at runtime and you can simply access them via custom actions ( under the arrayList or hashtable section of the action browser).

 If you have trouble implement it, don't hesitate to contact me.

 Bye,

 Jean

jerware

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: How to best make a gallery?
« Reply #2 on: June 04, 2012, 12:30:36 PM »
Thank you so much. I will try this out.

jerware

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: How to best make a gallery?
« Reply #3 on: June 04, 2012, 02:33:21 PM »
I'm sure I've just setup my project wrong or something (I don't use an /Assets folder, but I guess I should?), but I get this error when adding one of you actions to a component, and then Unity crashes to the Windows desktop.

jerware

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: How to best make a gallery?
« Reply #4 on: June 04, 2012, 03:42:22 PM »
Ok, I made a new project and everything is working now. Unfortunately I can't seem to get the "Array List Get" action to store a texture in a variable. I have added a "Play Maker Array List Proxy" to the same object with the FSM (prefill type Texture with two items/textures assigned), created an empty texture FSM variable, and tried to change that variable using your Array List Get action. If I initialize the variable with a texture, that gets used when I "Set Material Texture," but it never gets changed by your action.

Am I doing something wrong (likely), or have I encountered a bug?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14593
  • Official Playmaker Support
    • View Profile
Re: How to best make a gallery?
« Reply #5 on: June 04, 2012, 10:33:13 PM »
Hi,

 yes, sorry, it's been reported before, and I made the fix only never committed it to the actual package, my bad...

http://hutonggames.com/playmakerforum/index.php?topic=1199.0

Sorry about the trouble...  I have to first get out of the way vectrosity and input.touches, then I will give arrayMaker attention.

Bye,

 Jean