Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Webtech

Pages: [1]
General Discussion / Vectrosity Updated
« on: January 29, 2015, 02:42:48 AM »

Just wondering if anyone is already working on the updated playmaker actions for Vectrosity?

If not, I'll start attempting to update them for the new version myself.



Playmaker Help / Get Position Problems
« on: January 13, 2015, 06:08:35 AM »
Hi there,

Im having trouble with the Get Position action. It permantly stays at 0.

I have at the start of the action a 'Collision 2d Event' which stores the Collider into a variable which I can see fine. The next step is that it uses Get Position to attain the 'X' property from the stored object. X is always zero.

If I breakpoint the FSM and then in the Hierarchy find the colliding object I can see the 'X' position is never zero.

Any ideas? The coliding object is one instantiated from a prefab but thats why I store the colliding object and check that one.

Little stuck.

Playmaker Tips & Tricks / C# Event binding to FSM Event
« on: January 10, 2015, 10:05:21 AM »

Couldn't find a way to do this built in so wrote a little script which hooks everything up....apart from one thing which I'll explain after the script. It works fine on PC/OSX, should work on iOS as I've done something similar in the past. I can't check on Android though but as it's only using the built in libraries I don't see why not.

Here is the script.

Code: [Select]
using System;
using System.Reflection;
using UnityEngine;

public class SendFSMEvent : MonoBehaviour
    public Component BroadcastingComponent;
    public string EventToSend;
    public string ListenForEvent;
    public PlayMakerFSM RecievingFSM;

    private void Start()
        var eventInfo = BroadcastingComponent.GetType().GetEvent(ListenForEvent);
        var eventArgType = GetEventArgsType(eventInfo);
        var methodInfo = typeof (SendFSMEvent).GetMethod("OnEvent");
        var boundEventhandler = methodInfo.MakeGenericMethod(eventArgType);
        var newDelegate = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, boundEventhandler);
        eventInfo.AddEventHandler(this, newDelegate);

    public Type GetEventArgsType(EventInfo eventType)
        var eventHandlerType = eventType.EventHandlerType;
        var method = eventHandlerType.GetMethod("Invoke");
        var parameters = method.GetParameters();
        return parameters[0].ParameterType;

    public void OnEvent<TEventArgsType>(TEventArgsType eventArgs)

The gist of what you need to do is throw this script on a GameObject, drag the script (not the game object) of what is firing the event (so if you use EasyTouch then you would grab the EasyButton/EasyJoystick etc script from within the GameObject) into the Broadcasting Component property in the Inspector. Enter the name of the c# event you are wanting to hook up into the Listen For Event property. Then drag the gameObject which contains the Event you want to fire into the ReceivingFSM property and finally type in the name of the FSM event you want to trigger in the Event to Send. Thats it. I've used reflection and generics to hook up a generic C# event which just triggers the FSM event. It works fine for simple triggers and I'll work some more on this too but thought at this stage people may want to play with it.

Things I know I need to do.
  • Hook up a way to transfer the eventArgs data
  • Find a way to differentiate between two controls firing the same event (i.e Two Easy Buttons, but this could be solved by transferring the eventArgs)

Any additions people want let me know or if I've properly gone west and there is a built in way to sort this :).

Pages: [1]