playMaker

Author Topic: calling a button press (SOLVED)  (Read 2051 times)

dittytwo

  • Playmaker Newbie
  • *
  • Posts: 4
calling a button press (SOLVED)
« on: October 06, 2016, 08:29:15 AM »
Hi there

The layout we have is a map with generically loaded Point of interest (POI) these will be generated on the fly and the locations reported to the GUI buttons of the POI's

We have on the UGUI 6 buttons that correspond to their POI and on click send the camera from current location where ever that is via Itween to the POI.

I also have an auto camera that goes from POI to POI with a pause between the two for demonstration purposes.

The auto camera at the moment is a fixed point reference (i.e. itween from poi 1 camera point to POI2 camera point pause itween POI2 camera point to POI3 camera point pause....etc.). ok now for the question, this is probably really simple.

how do i call a button press on the uGUI buttons. This is so that when the map moves and the POI's change the auto camera will still work as it will call the button 1 pause then button 2... etc.the poi's will change as will there location i would rather only have to change them in one location programatically

cheers for reading
 
« Last Edit: October 11, 2016, 10:13:13 AM by dittytwo »

dittytwo

  • Playmaker Newbie
  • *
  • Posts: 4
Re: calling a button press
« Reply #1 on: October 10, 2016, 09:54:17 AM »
hi there
i have created a demo version (hopefully attached)
all want to do is get "button clicker" button to, click button and button 1, in turn.
i can't seem to get this to work.

cheers

dittytwo

  • Playmaker Newbie
  • *
  • Posts: 4
Re: calling a button press
« Reply #2 on: October 11, 2016, 10:12:49 AM »
Hi all
If anyone has a similar issue to solve this follow these steps

add this action to the "button clicker" button in this instance
Action browser > ScriptControl > Send Message
then set the following
set to specify the game object and set to the target object "button"
Set Delivery : Send Message
Leave as Options : Don't require Receiver
Set Method Name: Press (Pick from drop down options, or type in)
Leave as Parameter : None

This however ended up causing a separate issue in the demo where "button" would still be in the transitioning state of itweening if "button 1" was clicked whilst moving, leaving "button" unusable as it never entered the finish state.
To solve this you can use the same method above but change the Method Name to SendEvent and set the Parameter to String and the value to your desired Finished state.
On further investigation i found that either button could get into this state of itweening but never reaching the finish state. So I added a "U GUI Button on Click Event" before the itweening to set the opposite button to the Finished state.

I hope this helps someone I have included the resolved project so you can see the solution.

cheers
D2