playMaker

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

Pages: [1] 2 3 ... 6
1
PlayMaker Help / Referecing a global manager[SOLVED]
« on: September 11, 2018, 02:18:46 AM »
I am currently tidying up my game logic and made a few mistakes in using global variables to handle logic. I want to come away from using global variables and have one FSM manage all of this. Ive been looking into using something like a singleton. Now all that I'm struggling with is the best approach to reference this singleton. Lets call it 'manager'. Its more complex as most of my objects are prefabs, so no way of using parenting as an alternative .

The only option that I have read about is (https://www.youtube.com/watch?v=u4PV78MB2xE)...

1. Use a global variable to store a reference to the 'manager'.

but don't really want to use a global variable as this defeats the object. I don't want to use broadcast etc to the performance impact.

Is there another option for this?

Nick

2
PlayMaker Help / check if a fsm variable is local or global [SOLVED]
« on: August 22, 2018, 07:50:16 AM »
Hi

I am using a custom script for an action and want to know if the local FsmBool is pointing to the fsm variables or the global variables.

I'm using...

Code: [Select]
targetaction.boolVariable("Example 1")
Any idea how i can do this?


3
Hi,

I am creating a CustomActionEditor and it seems when you try and access a value of a variable without calling DrawDefaultInspector() it throws the following error when adding the script from the actions panel to the FSM for the first time.
"NullReferenceException: Object reference not set to an instance of an object"

If i include the DrawDefaultInspector() I get no errors.

It seems there is an issue with hiding DrawDefaultInspector() and calling variables by reference. ? The culprit is this.... "action.databaseName.Value"

NOTE: if i save and refresh the scene, or click off the FSM and click back into it, the error message goes away.

Code: [Select]
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using HutongGames.PlayMakerEditor;

using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEditorInternal;

[CustomActionEditor(typeof(PMDTAddRow))]
public class TestCustomEditor : CustomActionEditor
{

private static Testing action;
private bool isDirty = false;

public override void OnEnable()
    {
        action = target as Testing;
    }

    public override bool OnGUI()
    {
        //reset isDirty
isDirty = false;

//blocks everything that follows if in Action Browser (so that no errors happen when getting scene-references)
if(action.Fsm == null || action.Fsm.FsmComponent == null) {
return false;
}

//isDirty = DrawDefaultInspector();

//Example
FsmString _myDatabaseName = EditorGUILayout.DelayedTextField("Database Name", action.databaseName.Value);

return isDirty || GUI.changed;

    }

}

4
PlayMaker Help / Custom action NullReferenceException issue
« on: June 15, 2018, 06:42:34 AM »
I am getting the following error (attached) in my custom action editor only when i go to add it to the FSM from the FSM Action Editor. Any ideas? as it works when I add the action and clear the errors.

seems the issue is with calling the actions variable value before the FSMEditor is open (action.databaseName.Value)

NullReferenceException: Object reference not set to an instance of an object
PMDTAddRowCustomEditor.OnGUI () (at Assets/Scripts/Test/Editor/PlaymakerTestActionEditor.cs:18)

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Code: [Select]
[CustomActionEditor(typeof(PMDTAddRow))]
public class PMDTAddRowCustomEditor : CustomActionEditor
{

private static PMDTAddRow action;
private bool isDirty = false;
PlayMakerFSM _fsm;

public override void OnEnable()
    {
        action = target as PMDTAddRow;
    }

public override bool OnGUI()
{
isDirty = false;

                FsmString _myDatabaseName = EditorGUILayout.DelayedTextField("Test Field", action.databaseName.Value);

if (action.databaseName.Value != _myDatabaseName.Value){
action.databaseName = _myDatabaseName;
isDirty = BuildFsmVariableList();
}
else if (_myDatabaseName.Value == "")
{
EditorGUILayout.HelpBox("test else if", MessageType.Error);
}

else {
EditorGUILayout.HelpBox("test else", MessageType.None);
isDirty = BuildFsmVariableList();
}

}

}

5
PlayMaker Help / Editing FsmVar Element Names In CutomActionEditor
« on: May 18, 2018, 06:35:31 AM »
Hi

I need to change the labels for FsmVar[] element names. Currently they are labeled as "Element 1", "Element 2" etc...

But I would want to change them to be unique, not incremental numbers at the end.

e.g. "Name", "Name zyz" etc...

Is this possible?

But more importantly im using [UIHint(UIHint.Variable)]. I have thought about adding in EditorGUILayout field, but i need boxes which im able to select local FSM variables from, from the action. But not been able to achieve this.

Nick

6
PlayMaker Help / LookAt2 action not working in Unity 2017.3 [SOLVED]
« on: April 21, 2018, 07:58:33 AM »
Hi,

I have tested the action (attached) I got from the forum a while ago called LookAt2.cs and it works in Unity 5.6.5f1 but when i updated my project to Unity 2017.31f1 the script doesnt work as intended. It looks at the target object but does not keep doing this everyframe regardless of checking the box.

Even the draw debug line doesnt work anymore.

Any ideas?

Nick

7
Hi

Since i updated to Unity 2017.3 i am now getting the following message appearing on the prefabs that have FSM's on (attached image).

If i remove them and update the prefabs then they just re-appear.

Nick


8
PlayMaker Help / Playmaker dlls files included in build
« on: April 18, 2018, 03:43:28 AM »
Hi,

I'm currently reducing my games build size and noticed that there are the following dll files included in the build. I'm targeting Android and wondered why are the others being included automatically? is there an option to turn the 'webgl, metro and wp8' dlls from being included? or will this break things?

Assets\Plugins\PlayMaker\Playmaker.dll
Assets\Plugins\PlayMaker\Metro\Playmaker.dll
Assets\Plugins\PlayMaker\WebGL\Playmaker.dll
Assets\Plugins\PlayMaker\WP8\Playmaker.dll
Assets\PlayMaker\ConditionalExpression.dll


UPDATE:
I stumbled across these posts and i can see that there must be an issue with the scripts etc being included when they are not being used/referenced. http://hutonggames.com/playmakerforum/index.php?topic=4752.msg54687#msg54687
https://hutonggames.com/playmakerforum/index.php?topic=10868.0

Nick

9
Hi

I have a CustomActionEditor script and have a FsmVar[] variable which i want to populate from a script which just takes selected variable names and populates the FsmVar[] with these. I can update all other variables types but i cant seem to update FsmVar. What am i doing wrong? do i need to somehow refresh the editor when i update the FsmVar?

Here is my script where "xxxxx" is the FsmVar[].

Code: [Select]
[CustomActionEditor(typeof(PMDTAddRow))]
public class PMDTAddRowCustomEditor : CustomActionEditor
{

    public override void OnEnable()
    {

var action = target as PMDTAddRow;

                DrawDefaultInspector();

                List<string> fsmvars = new List<string>();

PlayMakerFSM[] fsms = Resources.FindObjectsOfTypeAll(typeof(PlayMakerFSM)) as PlayMakerFSM[]; //get all fsms in scene

if (fsms != null)
{
foreach (PlayMakerFSM _fsm in fsms) //fsm
{
if (_fsm.Fsm.Variables.ArrayVariables.Length > 0)
{
for (var i = 0; i < _fsm.Fsm.Variables.ArrayVariables.Length; i++)
{
if(_fsm.Fsm.Variables.ArrayVariables[i].Name.StartsWith("example"))
{
fsmvars.Add(_fsm.Fsm.Variables.ArrayVariables[i].Name);
//Debug.Log(_fsm.Fsm.Variables.ArrayVariables[i].Name);
}
}
}
}
}

if (action.xxxxx.Length != fsmvars.Count)
{
action.xxxxx = new FsmVar[fsmvars.Count];
}

for (var v = 0; v < fsmvars.Count; v++)
{

var fsmArray = action.fsmComponent.FsmVariables.GetFsmArray(fsmvars[v]);

if (fsmArray != null ) {
action.xxxxx[v].UpdateValue();
action.xxxxx[v].variableName = fsmArray.Name;
}
}
}
}

10
PlayMaker Help / FSM variables - detect changes made during playmode
« on: January 26, 2018, 04:15:00 AM »
Hi

I am currently writing editorwindow scripts but i have a query to ask. Basically im editing values during editmode via scripts. Now i want to track FSM variable value changes during playmode. So if FSM string var updated i can get the name/value of this.

I ask as i know that playmaker allows editing of values during playmode but resets them after play, now i imagine that when a value updates on a variable that it may be that its logged somewhere, but i have a feeling that its not?

Im after making a tool which can apply the changes made during playmode and update the fsm's accordingly after exiting playmode.

Nick

11
PlayMaker Help / API FsmVar get/set 'Category' and get 'Used' count
« on: December 27, 2017, 06:18:42 AM »
Hi,

Im using the API for a custom editor window and i wondered is it possible to get/set the FSM variable 'Category' and also get the 'Used' count of a fsmvar? (image attached).

Nick

12
PlayMaker Help / Add variable to FSM during edit mode [SOLVED]
« on: December 20, 2017, 04:26:15 AM »
Hi

Im using a custom editor window and I want to be able to add a new variable when i press a GUI button using the API, but the only guide i found was accessing the fsm variable array and then adding the new value to it but I dont need to find it but just add.

I can see there is a FindFSMString and GetFSMString but is there something like a AddFSMString?

FsmVariables.GetFsmString("example")

all i want to do is essentially create a new variable and change its name and type. Like you would when you manually add a new variable in the FsmEditor.

Nick

13
PlayMaker Help / EditorWindow API update FSM values Issue [SOLVED]
« on: November 29, 2017, 08:10:14 AM »
Hi, Im using a custom EditorWindow to update variables in FSM's using the API and i can successfully update the FSM variables whilst in Editmode. But if i change scene or run the game, the values get reset back to the default? weird.

I can see that the values are changing in each FSM when i update it in my custom window and if i save the scene it still reverts back to the last known configuration. This was only a quick test and its all being called in ONGUI at the moment but wont stay this way.

here is a video of the issue.
https://drive.google.com/open?id=1YjT7as-C78WCv8wLYOy4IrxfB4OiHMFA

Code: [Select]
void OnGUI ()
{
PlayMakerFSM[] each = GameObject.Find("Main Camera").GetComponents<PlayMakerFSM>();

for (int s = 0; s < targetfsm.FsmStates.Length; ++s)
{
foreach(FsmStateAction action in targetfsm.FsmStates[s].Actions)
{
if (action.GetType() == typeof(HutongGames.PlayMaker.Actions.PlaymakerDataTables))
{
HutongGames.PlayMaker.Actions.PlaymakerDataTables pdt = (HutongGames.PlayMaker.Actions.PlaymakerDataTables)(action);

if (pdt.databaseName.Value == "Characters") //get db name from chosen
{
GUILayout.BeginHorizontal(EditorStyles.textArea); //pass in style

for (var i = 0; i < pdt.databaseColumnKeys.Length; i++)
{
//DATABASE TABLE KEYS
pdt.databaseColumnKeys[i] = EditorGUILayout.TextField("", pdt.databaseColumnKeys[i], EditorStyles.label, minwidth, expandwidth);
}
GUILayout.EndHorizontal();
}
}
}
}
}


14
PlayMaker Help / When will 'MatchElementType' be available [SOLVED]
« on: October 27, 2017, 07:00:26 AM »
Hi

I notice in some scripts that there is a 'MatchElementType' commented out, when will this feature be released?

//[MatchElementType("array")] TODO
(\Assets\PlayMaker\Actions\Array\GetFsmArrayItem.cs)

Nick

15
PlayMaker Help / Exposing FSM Variables In A Custom EditorWindow [SOLVED]
« on: October 10, 2017, 06:56:53 AM »
Hi

I am creating a 'custom action' and I wanted to be able to extend the action by making a custom EditorWindow https://docs.unity3d.com/ScriptReference/EditorWindow.html and then be able to edit FSM variables within this.

I do not want to control the custom action script, I just want to make the variables editable in my EditorWindow im making. so the process is similar to how the 'playmaker controls inspector panel' works with exposing the variable using the checkbox.

Hope im making sense.

Nick


Pages: [1] 2 3 ... 6