uGUI Button with Parameters (Now as OnClick Trigger BloxEvent)


(RaiuLyn) #21

Current Plans for version 3:

Does not require a Button Component. Works with uGUI button/text/image and GameObject(with Collider)
OnClicks (Up, Down, Enter, Exit, etc)
Multiple Parameters
Nameable Parameters

Note:


Now that Leslie has released a solution for including parameters, I’m debating whether or not that I should continue on updating OnClickTriggerBloxEvent. Since he has that covered, this would be the last major update and I could move on to making other things. Even so, if you have problems/issues/bugs, don’t hesitate to PM or mention me. As of now, I have not received any complaints or anything as I don’t look at the forum looking for issues. :confused:


(Leslie Young) #22

Note that the update was for Blox 2, not plyBlox as included in plyGame.


(RaiuLyn) #23

Thanks for waiting as OnClickTriggerBloxEvent has received an overhaul.

Now feast your eyes at the update notes of Version 3:
Button Component is not needed anymore(No joking). Works with uGUI button/text/image(without Button Component) and Gameobject(with Collider) as intended. Note: Be sure to add either a ‘Physics Raycaster’ or ‘Physics 2DRaycaster’ component to your camera to be able to click on Gamobjects or Sprites respectively.
Multiple Parameters. Able to send more than the usual 3 Param slots.
Nameable Parameters. Able to give variables fancy names.
Different Click Methods. Click version of OnButtonUp, OnButtonDown, OnButtonEnter, OnButtonExit
Different mouse inputs. Left, right or middle.
Variable scopes. Set variable to either Temp, Local or Global.
Added Item type. Finds an Item from the Items tab in PlyGame and returns as an Item variable. Formally a solution for Param issue/Question where a string does not work correctly but left it as an extra option to have.

It will break its previous Script so you have to redo them all. But it’s a small sacrifice for more Params and being able to name them.


(RaiuLyn) #24

Version 4 update notes:

Moved Click behavior and Mouse Input to being parameter requirements
Added Debug Message
Added additional requirement (Keycode)
Removed restriction on requiring one param to work
Revamped Inspector for clean interface
Fixed an issue regarding Active States

As usual, expect breakage and having to redo setups.
Preview:


(RaiuLyn) #25

OnClick Trigger BloxEvent v4 is out. The download link is in the OP.

What\s next? I still have to do plyblocks for it for runtime use. After that, I’m officially done with the plugin.


(Marshall Heffernan) #26

The download in the OP is no good.

  1. Says this inside


  1. Cannot specify Right Click.

  2. Params are all wrong:
    String allows you to write in an Int
    Int allows floats
    Float has a Bool checkbox
    Bool has a Vector 3,
    Vector 3 has a Vector 2, etc.

  1. There are two scripts included in OP .zip
    • OnClickTriggerBloxEvent
    • OnClickTriggerBloxEvent_Editor

what is the Editor one for? Tried to drop it onto a Button, but Unity says the script must derive from MonoDevelop.

I’m probably doing something wrong on my end, but lemme know. Thanks.


(RaiuLyn) #27

Just downloaded the file in the OP and it works just fine on my side. I forgot to change v3 to v4.1.

So the only conclusion I can think of it that the Editor script got botched. The Editor script is for changing the script’s inspector of its visual form like the ‘Add Parameter’ button and organizing which input values according to type and such. Just leave it in the Editor folder.

Try redownload and let me know if that fixes the problem.

In the next (probably final) update, It will be exported as a unitypackage file to save people from the hassle once I’m done with the blocks.


(Marshall Heffernan) #28

It still doesn’t work.


I made my own script, though.
Right clicking a button triggers a custom blox event called “RightClick”.
Left clicking a button triggers a custom blox event called “LeftClick”.

Never needed the parameters, just right click functionality for buttons.

ButtonClicks.cs (541 Bytes)


(Leslie Young) #29

@itsmars I used to include this with plyGame. You might have old scripts still and those are conflicting with the new? I am not sure which folder it used to live in though so just check for similar named scripts in your project and override or remove it. Note that there are two scripts and one of them must be in a folder named “editor”.

Just tested the file attached in OP and I see the same interface raiulyn shows in previous post.