playMaker

Author Topic: Is there a way to create GUILayout buttons with ArrayMaker?  (Read 3484 times)

vovkasolovev

  • Playmaker Newbie
  • *
  • Posts: 3
Is there a way to create GUILayout buttons with ArrayMaker?
« on: April 27, 2014, 06:34:09 PM »
Hello!

I am trying to make game where player control spaceship builded with modules. Modules give to ship lot of special abilities (fire, throttle, activate shield etc). So I need to create some buttons to allow player activate special abilities. Ship can have a lot of modules so I can't make buttons individually, I need to make them from array (and from XML in future).

I have ArrayList of textures with some abilities icons.
I need to check «Is this button avalable for player?», and if «Yes» create GUILayout button with certain «Send Event» action. and if «No» — skip creating this button.

And here a bunch of problems:

1) GUILayout Button must be created in one State with GUILayout Begin Area and GUILayout End Area. I get error when I put Begin and End in to different States (when I need loop inside).

2) GUILayout Button can't be used in loop (like in ArrayMaker «GameObjectPositioning» example) because it don't create new instance of button. It use same button every loop.

3) I can't find a way to specify button's Send Event from variable.


Please, help me find right way to create these buttons from array.

To make it easier, I put simplified and broken example of my task (for Playmaker and Arraymaker) and sketch of my goal in attachments.
« Last Edit: April 27, 2014, 06:36:06 PM by vovkasolovev »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there a way to create GUILayout buttons with ArrayMaker?
« Reply #1 on: April 28, 2014, 08:59:26 AM »
Hi,

 You can't if you are using Unity gui, as PlayMaker integration with Unity gui doesn't allow for persistant widgets so we can't do custom content.

 If you can use ngui or daiken forge then it's possible.

bye,

 Jean

vovkasolovev

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Is there a way to create GUILayout buttons with ArrayMaker?
« Reply #2 on: April 28, 2014, 12:54:42 PM »
Oh... deeply discouraged now.
Thanks for answer.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there a way to create GUILayout buttons with ArrayMaker?
« Reply #3 on: April 28, 2014, 02:08:03 PM »
Hi,

 Why? Unity gui is far from being adequate on many projects. I think you should embrace proper 2d frameworks, they will give you a lot more flexibility.

Having said that, I worked on a system few years ago where you define your UI using xml, and it uses Unity GUI, the good thing about this is that it would all become persistent, if you create a button it will stay on screen until you explicitly delete it. AND this xml descriptiong has PlayMaker data and event bindings all over, allowing to create a powerful UI just with xml.

 If you are interested I can send you the package. Since it's unfinished, you'll ned to script here and there the missing bits, but it could be solving some problems for you.

bye

 Jean
 

vovkasolovev

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Is there a way to create GUILayout buttons with ArrayMaker?
« Reply #4 on: May 13, 2014, 11:53:04 PM »
I'm disappointed because the states and events — the basic nature of the buttons. And in Playmaker (because of Unity) buttons realized is so wrong — I can't generate 100 buttons and wait events from them in one FSM. I need manualy create 100 buttons and 100 FSM. Another way: create 100 GUI Layout Buttons in one State!

And I don't want to stuck with one more framework. So now I implement button generator in C#, and waiting for future release of Unity with promised GUI creation interface.

But to make it clear, please, is there way to check in FSM «is button enabled» when i create lot of buttons in one state inside Scroll View? (no XML, no ArrayMaker)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is there a way to create GUILayout buttons with ArrayMaker?
« Reply #5 on: May 14, 2014, 12:26:53 AM »
Hi,

 Unfortunatly no, you'll have to resort to a third party addon or proper ui framework to create complex UI using Unity UI or else.

I would in all cases strongly recommand not to use Unity GUI system as it is definitly not the most flexible and performant system, especially if you target mobile for example.

I have created a system that lets you create persistent Unity GUI elements with PlayMaker ( backed with a full flegde xml description of the UI), it's an alpha system but it aims at solving exactly this, persistance of Unity GUI elements.

Bye,

 Jean