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.

Messages - 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 / Re: Get Position Problems
« on: January 13, 2015, 06:55:58 AM »
A bit more digging inbetween doing something else and I figured out that it isn't the Get Position with the error. It's the 2d Collider. I'll have to see properly whats going on to see if it is my fault or a general bug but looks like the Collider it stores is wrong. It name's it correctly, highlights the right one in the heirachy view but doesn't show all the scripts attached etc until I double click the highlighted on in the hierarchy view. Not sure if I'm getting a child of the object I want yet. Will check in a bit.

Playmaker Help / Re: Get Position Problems
« on: January 13, 2015, 06:28:23 AM »
Are you sure?

Just I'm sitting here right now and in the Scene View I can adjust my objects (sprites) position using the transforms->Position->X and my object moves left and right on the scene. I also within playmaker set the X position to -10 or 10 to determine if the object will start from the left or right side of the screen.

To me, in 2D. X is left and right, Y is up and down and Z is Depth (Well drawing order in 2D).....

I'm only using the 2D collider to determine what object hit, after that its the standard Get Position action....

very Confused now.

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]