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 - Sjones

Pages: [1] 2 3
Feature Requests / show if variable is global in state tab
« on: May 31, 2017, 05:07:23 PM »
I'm pretty sure that playmaker used to show globals/variable name in the FSM state tab for those variables that where global, instead it now just shows the variable name, which is a problem when you have a global and a local variable with the same name.
since upgrading from an old version of PM I have gone to change variables several times as I keep thinking they are local when they need to be the global variant.

was there a reason for this change or could there be an issue with the upgrade process?

Action Requests / mouse pick to select camera
« on: May 26, 2017, 12:08:22 PM »
I have recently updated to unit 5.6 and have had an issue where, due to physx removing support for non-convex meshes as triggers, part of my UI no longer works as I was using a mesh to get specific areas of the UI and send event back to unity.

so, as usual with game dev, tying to find solutions to fix issues - I have just spent ages trying to use the mouse pick actions, mostly mouse pick 2d and sprites - long story short - my UI is not on the main camera (I am using an old version of ngui)

So I done a whole load of testing, when the main camera is on and the object is in view of this camera - it works - when I then move it in front of the UI camera it no longer works.

Looking at all the other screen/mouse pick actions they all seem to use the main camera - is it possible to amend them to allow the user to select the camera they want to ray cast from, this would make all those scripts a lot more versatile.


Playmaker Help / SQLite kit, PM & colors
« on: July 03, 2014, 12:11:11 PM »
I am trying to save colors out to an SQLite database with the SQLite kit and having difficulty loading the data back into a color.

When saving an FsmColor to the database it reads like this:
between brackets are the actual decimal numbers.

As this is a string I can't find a way to get it back to a color in unity (which I can then set back to the FsmColor)

The only way I can see of doing this is either to save each channel out as a float in a separate column in the database (but this creates 2 more columns that I would imagine has some sort of performance hit) or to manipulate the text to get the 3 values and then convert them to floats to finally combine them to a color.

Share New Actions / Get texture pixel colour RBG
« on: August 14, 2013, 07:02:58 AM »
A simple script that will get the pixel colour in the RGB Channels in the form of a float between 0-1

For performance reasons it will not get the nexture every frame, if your texture changes and you need to get the colour from the new texture you will need to exit and re-enter the state (or move onto the next state etc) to get the updated texture.

the per-frame will get the updated coordinates pixel every frame. It works for X horizontal and Y for vertical starting in the bottom left corner of the texture.

iOS Help / iOS/Android 101
« on: May 01, 2013, 01:05:38 AM »
iOS / Android 101

Many people ask a lot of questions about the mobile platform and how to do things within playmaker.

So I thought I would make this outline to answer all the most common questions.

If people have any other common question I have missed post a message and I will look into how common it is and an answer - this is not a post for every question about iOS and android.

First of all I want to put Playmaker into perspective here, playmaker (with some exceptions) extends only what unity comes with (there are other add-ons - actions - but those are related to those plugins and I will not be focusing on them here, only playmaker and unity)

Before I start, please watch all the playmaker tutorials provided for free, they are excellent and even though some of them are not related to mobile development, their setups, actions and implementations can be used on any platform

so down to business.
Q. How do I implement this control scheme or that control scheme, including tapping, sliding and / or gestures.

A. Unity itself does not have any gesture controls built in to it - as such playmaker doesnt either - to do any gesture control including swipe, pinch etc you will either need to buy a plugin that is supported by playmaker with actions OR use the unity functions of touch event and touch info - these will give you any touch event and then once touched the info about that touch - you then use this in mathematical equations (rect to test if it is in an area of the screen or sqr root of the 2 fingers for distance e.g. zoom) to calculate the gestures.

Q. I am using Unity GUI how do I....

A. I strongly recommend using anything but the built in GUI for iOS or android - if you can afford the mobile license invest in a bit more with something like nGui - the unity GUI is too expensive for mobile platforms - if you want to research into why search for draw calls - but the basics of it is the original ipad could handle ~25 draw calls and each GUI element = 1 draw call. Apart from this it is limiting that they don't recognize ontouch and the texture and animation options.

Q. How do I tap to get, tap to drag or tap to interact

A. This again is to do with touch info and Screen Pick, you can save the object you touch with the raycast (from within the actions) and collision around that object - do tests like did it touch object - yes do something - no do something else, to move something store the game object and then pass the position from the touch info to the object position itself - you can also filter by layers to help with touching an object or not - or a specific set of objects.

Q. How do I control the camera with touch.

A. again use the touch info - either the position or the delta - if you want it to orbit - set an iTween with a look at target and rotational info - remember to have every frame active on the state to constantly update.

Q. My game is laggy, unresponsive or slow.

A. This will be performance issues, the main things to look out for.

   Draw calls - this eats cpu time up - the less the better - combine meshes together and don't use the unity GUI

   Shaders - if you don't know much about shaders always use the mobile shaders provided by unity

   Shaders Advanced - Don't use multiple pass shaders

   Polycount - make sure you have not got too many polygons in the scene at any one time - also make sure your 3D objects are not too high poly count - large polycount meshes slow the rendering time down - at this point its better to have several smaller meshes

   Lights - always have your lights baked for mobile - real time / dynamic lights are very expensive

   Physics - don't use too many physics at any one time, this will also eat into cpu time - set to is trigger if you don't want the physics engine to calculate that collision mesh (ray trace and trigger event should both work still)

   Textures - do not have too many texture - this is going to be the least bottle neck nowadays as most phones have a fair amount of memory for textures - but doesn't mean you can go mad.

   Playmaker - having too many active playmaker FSM's can slow the game down - think about what needs to be run separately and what can be combined into a single large FSM.

Through my experience of playmaker - I have notices in my game that the following actions are used the most in combination with others though - I have kept them to the most relevent to mobile - I have udes many more but this is more to do with the type of game rather than the platform - though these are not limited to iOS or android.

Get touch Count
Get Touch Info
Touch Event
Activate Game Object
Add Component
Create Object - Caution this is expensive - I have used it in menus where the lag spike is not noticable
Destroy Component
Set Game Objetc
iTween Move To
iTween Scale To
Set Material
Next Frame Event
Send Event
Get Position
Set Position
Set Property (used a total of over 800 times in my game)

P.S. - I have posted it here in the iOS section as iOS is more popular - if the forum admins think this is useful then it can also be posted in the android sub forum. - but for now I do not want to double post / spam the forums.

Action Requests / Ease float - ping pong
« on: April 30, 2013, 09:57:53 PM »
Can someone extend the Ease Float to include a ping/pong effect like the iTween functions do?


Action Requests / return lowest float from a set of variables.
« on: April 26, 2013, 08:57:17 AM »
I need to get the lowest number from several float variables - can someone make a script or point me in the direction using existing actions.


Playmaker Bug Reporting / odd FSM
« on: April 23, 2013, 03:47:18 AM »
I am not sure how this happened, it shouldn't even be possible but it has just happened

An Fsm with no start state and a duplicate state (name as well)

The Fsm is attached to a prefab, tried to load the prefab at runtime to find out it didnt work and this was what I found after inspecting it.

forgot to mention I am using PM 1.5.4 and untiy 3.5.6f3

Action Requests / Set all children's colliders IsTrigger[SOLVED]
« on: April 12, 2013, 11:13:00 AM »
I am having problems with triggers, custom meshes and instantiating objects with rigidbodys.

However for the most part I have work arounds for the problems I am having.

The last issue is fixed if I manually set IsTrigger to true when I need it to be, I know that this can be done in PM 1 at a time, however with each object having multiple colliders and then I have multiple objects, I would have to set over 300 colliders properties to IsTrigger = true

So I was wondering if there was an action someone could make to set all child objects colliders (be it box, sphere, mesh etc.) IsTrigger to a bool value.
I am not even sure this is possible but would mean that I would only need to set it for each object and not for each collider for each object.


Playmaker Help / triggers and mesh collision doesn't seem to work
« on: April 10, 2013, 12:07:43 PM »
I have read the unity docs over and over thinking I have done something wrong, but no matter what I do I cant seem to get mesh colliders to work with triggers in playmaker

using unity 3.5 & playmaker 1.5.4

I got an object that is set with a rigid body and 4 primitives as children for collision (boxes) with the collider set to IsTrigger

then I have a mesh collision for the terrain, the collision is set to IsTrigger again.

where as the trigger action works between primitive <--> primitive it is not working for primitive <--> mesh colliders.

can someone confirm that they can get the trigger event working with mesh colliders to either find out if this playmaker or myself going wrong.


Note* that only ontriggerenter and ontriggerexit works from what I have read as mesh collisions are calculated by surface and not volume

Playmaker Help / Adding Rigid Body[SOLVED]
« on: April 10, 2013, 08:30:02 AM »
When I try to add a ridgedbody component to an object the log says
"Cube : FSM : Set_Rigid : AddComponent : Can't add component: Rigidbody"

yet it still adds it...

I just had unity crash with this being the last log entry (before it closed) not sure if its related.

is this the correct way to do it, any particular reason there is an error when it does in fact add it? or is this something that isn't supposed to work, but somehow is?

Code: [Select]
Cube : FSM : Set_Rigid : AddComponent : Can't add component: Rigidbody
HutongGames.PlayMaker.FsmLog:LogAction(FsmLogType, String)
HutongGames.PlayMaker.Actions.AddComponent:DoAddComponent() (at Assets/PlayMaker/Actions/AddComponent.cs:62)
HutongGames.PlayMaker.Actions.AddComponent:OnEnter() (at Assets/PlayMaker/Actions/AddComponent.cs:39)

I have used this a fair bit, using it for optimization purposes and this is the first crash, but also the first time I noticed the error, though the error seems to always happen but still works

Playmaker Help / triggers and the different events[SOLVED]
« on: April 09, 2013, 08:59:00 PM »
I am back to the collision (been using the old PM 1.4 for testing)

I had some issues way back when 1.4.4 came out, I am not entirely sure I have resolved them 100% but I am making progress.

one problem I am having with a custom script that was working before was a script listening to all 3 types of trigger events (edited the triggerEvent)

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using System;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
[Tooltip("Detect collisions with objects that have RigidBody components. \nNOTE: The system events, TRIGGER ENTER, TRIGGER STAY, and TRIGGER EXIT are sent when any object collides with the trigger. Use this action to filter collisions by Tag.")]
public class TriggerCount : FsmStateAction
// public TriggerType trigger;
public FsmString collideTag;
// public FsmEvent sendEvent;
public FsmInt collideCount;
// public FsmInt maxCollide;
public FsmBool collidedBool;
public bool everyFrame;

public override void Reset()
// trigger = TriggerType.OnTriggerEnter;
collideTag = "Untagged";
// sendEvent = null;
collideCount = null;
collidedBool = null;
everyFrame = false;

public override void OnEnter()
if (!everyFrame)

public override void DoTriggerEnter(Collider other)
if (other.gameObject.tag == collideTag.Value)
collideCount.Value = collideCount.Value + 1;

public override void DoTriggerExit(Collider other)
if (other.gameObject.tag == collideTag.Value)
collideCount.Value = collideCount.Value - 1;

public override void OnUpdate()
if (collideCount.Value == 0 )
collidedBool.Value = false;
collidedBool.Value = true;

// public override string ErrorCheck()
// {
// return ActionHelpers.CheckOwnerPhysicsSetup(Owner);
// }


the issue is with the update, from what I gather, it only can do one type per script?
Code: [Select]
public override void Awake()
switch (trigger)
case TriggerType.OnTriggerEnter:
Fsm.HandleTriggerEnter = true;
case TriggerType.OnTriggerStay:
Fsm.HandleTriggerStay = true;
case TriggerType.OnTriggerExit:
Fsm.HandleTriggerExit = true;

my version, based on the old system only records enters now and not exits (I dont test for stays) is this the case or am I wrong, is there a fix? or do I have to have 2 separate actions, if so is there a chance that it could miss an event if 2 actions are used?

Playmaker Bug Reporting / mathmatics
« on: March 23, 2013, 06:50:34 PM »
So this is more likely a bug with unity, but wtf...

using a float multiply I multiplied 700 by 1.2, I get the result 840.0001, where how and why has it got 0.0001 added to the end?

same if 700 x 1.19

and 700 x 1.18 gives a 0.99999 value

another one I found too was 70 x 1.17

So with a fix unlikely (as its unity not PM) anyone got any idea how to work around this?

Playmaker Help / Global variables clear on play
« on: March 12, 2013, 08:38:16 AM »
So I have a large problem at the moment...

Every time I hit the play button in editor the global variables remove themselves

as In they appear in the globals list but they are listed as used 0 times and in each FSM the actions they are used in the actions are now clear.

When I stop playing.... they return!

the console gives no errors at all! re-opening the level or unity makes no difference, they are there until the play button is played... Then poof

this means my game currently doesn't work at all

realy need some help / advice on this

Share New Actions / Static Batching
« on: March 12, 2013, 02:11:17 AM »
Too many draw calls? (Yes)

Making a lot of objects at runtime that are the same? (Yes)

do these objects move? (No)

Then this script is for you!

I have been testing it out in my project, made a derivative of this a few months that didn't work too well...

however I came back to it and found a working fix for it, this will combine all objects that are a child of a game object together for static batching at run time.

Quote from the unity help page on its limitations.
StaticBatchingUtility can prepare your objects to take advantage of Unity's static batching.

This step is useful as a performance optimization allowing engine to reduce number of draw-calls dramatically, but keep amount of rendered geometry intact.

By calling one of the Combine methods you will create an internal mesh which will contain combined geometry, however each original GameObject will be present in the scene and will be culled individually. The fact that GameObjects can be culled individually allows run-time to render the same amount of geometry as it would without batching, unlike combining geometry in the modeling tool. Combining geometry in the modeling tool prevents efficient culling and results in much higher amount of geometry being rendered.

Note that you do not need to call Combine methods on objects which were already marked as "Static" in the Editor. They will be prepared for static batching automatically during the Build Player step.

IMPORTANT: only objects with the same material can be batched, thus it is useful to share as many textures/material as you can.

something to also be aware of (not something I have tested but other people have said) is that your memory usage might go up, so better performance for CPU but less for memory.

Pages: [1] 2 3