Playmaker Forum

PlayMaker Help & Tips => Android Help => Topic started by: krysber on October 21, 2015, 04:22:38 AM

Title: GameObject->UI->Button and touch
Post by: krysber on October 21, 2015, 04:22:38 AM
I'm using Unity 4.6.1f1 and Playmaker 1.7.7.f6 and am trying to create a touchable button. I can create an empty object and add a GUITexture component to it and get touch working, but not buttons. They register the touch, but the FSMs don't start...
Title: Re: GameObject->UI->Button and touch
Post by: djaydino on October 21, 2015, 01:23:13 PM
Hi,
if you mean the Ugui Button,
then you need to get the Ugui Package on the EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181)

Then you need to add the Component "PlayMakerUGuiComponentProxy"

Then on that Component (if the fsm is on a different object) you need to set the target

Then you can use the build in event transitions (right click on state and select "add transition/Custom Events/Ugui)

Or you can use your own transition name and on the Component click on "Edit" and replace the transition name.
Title: Re: GameObject->UI->Button and touch
Post by: krysber on October 23, 2015, 04:23:15 PM
I'm not finding the "PlayMakerUGuiComponentProxy" component under neither Component nor PlayMaker in the menu in Unity after adding all items in Playmaker Ecosystem packages.
Title: Re: GameObject->UI->Button and touch
Post by: krysber on October 23, 2015, 04:36:09 PM
then you need to get the Ugui Package on the EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181)

Sorry, misread this as needing to just install EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181)...

(https://teacherorwildlifetrainer.files.wordpress.com/2015/08/double_facepalm.png)

Will update once I do this...
Title: Re: GameObject->UI->Button and touch
Post by: krysber on October 25, 2015, 07:22:44 PM
I have done this but get error:

Code: [Select]
Missing 'PlayMaker UGui' prefab in scene
UnityEngine.Debug:LogError(Object)
PlayMakerUGuiComponentProxy:FirePlayMakerEvent(FsmEventData) (at Assets/PlayMaker uGui/Proxies/PlayMakerUGuiComponentProxy.cs:461)
PlayMakerUGuiComponentProxy:OnClick() (at Assets/PlayMaker uGui/Proxies/PlayMakerUGuiComponentProxy.cs:320)
UnityEngine.EventSystems.EventSystem:Update()
Title: Re: GameObject->UI->Button and touch
Post by: djaydino on October 26, 2015, 02:22:13 AM
Hi,
go to the Playmaker uGui folder.
Then Prefabs folder and drag the prefab into your scene :)
Title: Re: GameObject->UI->Button and touch
Post by: krysber on October 27, 2015, 11:26:01 AM
I am getting two errors after importing UGUI now...

Error 1
Code: [Select]
Assets/PlayMaker Custom Actions/uGui/EventSystem/GetLastPointerEventData.cs(221,96): error CS1061: Type `UnityEngine.EventSystems.RaycastResult' does not contain a definition for `worldNormal' and no extension method `worldNormal' of type `UnityEngine.EventSystems.RaycastResult' could be found (are you missing a using directive or an assembly reference?)

Error 2
Code: [Select]
Assets/PlayMaker Custom Actions/uGui/EventSystem/GetLastPointerEventData.cs(226,98): error CS1061: Type `UnityEngine.EventSystems.RaycastResult' does not contain a definition for `worldPosition' and no extension method `worldPosition' of type `UnityEngine.EventSystems.RaycastResult' could be found (are you missing a using directive or an assembly reference?)

I have tried re-importing the offensive script after deleting it from Assets, but the error persists.
Title: Re: GameObject->UI->Button and touch
Post by: djaydino on October 27, 2015, 05:08:14 PM
Hi,
you could try updating playmaker.
I am on pm 1.7.8.3 but i am not sure if that is the problem but it might be.
Title: Re: GameObject->UI->Button and touch
Post by: krysber on October 28, 2015, 01:20:29 PM
I switched to Unity 5 and Playmaker 1.7.8.3 and it works! Thanks for your help djaydino.