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

Pages: [1] 2
1
PlayMaker Help / Dynamically change FSM throughout Prefabs
« on: July 29, 2021, 06:48:48 PM »
I'm building my levels with prefabs, sometimes complete levels, sometimes level sections and when I need them I simply spawn them.

Anyhow, I have some logic attached to each level prefab that does some needed stuff at a given moment and I trigger it through global events after spawning them. Each level is different, but the FSM on it is the same.

I built now 100 levels and have to change something in the logic of my FSM attached to these prefabs. If it was a C# script I simply would change the code in it and it automatically would be updated on all 100 prefabs. How is this possible with Playmaker FSMs though?

Templates seem not to work because they don't update dynamically either. This has me confused as hell and I'm surely missing the obvious here, right?

How can I dynamically change an FSM throughout several prefabs or how can I re-use FSMs by having only 1 Master FSM? What is the approach for this situation I'm sure many of you guys have resolved in your projects before.

2
Share New Actions / Particle System Set Random Between Two Colors
« on: July 27, 2021, 06:00:09 PM »
Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory(ActionCategory.Effects)]
[Tooltip("Sets the Start Color of a ParticleSystem using Random Between Two Colors.")]
public class ParticleSystemSetRandomBetweenTwoColors : ComponentAction<ParticleSystem>
{
        [RequiredField]
        [Tooltip("The GameObject with the ParticleSystem.")]
        [CheckForComponent(typeof(ParticleSystem))]
        public FsmOwnerDefault gameObject;

        [Tooltip("Color 1 of the Start Color")]
        public FsmColor color1;

        [Tooltip("Color 2 of the Start Color")]
        public FsmColor color2;

        [ActionSection("Repeat")]
        [Tooltip("Repeat every frame. Useful if the color variables are changing.")]
        public bool everyFrame;

        private ParticleSystem currentParticleSystem;
        private ParticleSystem.MainModule main;

        public override void Reset()
        {
            gameObject = null;
            color1 = Color.black;
            color2 = Color.black;
            everyFrame = false;
        }

        public override void OnEnter()
{
            currentParticleSystem = gameObject.GameObject.Value.GetComponent<ParticleSystem>();
            main = currentParticleSystem.main;


            SetColors();

            if (!everyFrame)
            {
                Finish();
            }
        }

        public override void OnUpdate()
        {
            SetColors();
        }

        private void SetColors()
        {
            main.startColor = new ParticleSystem.MinMaxGradient(color1.Value, color2.Value);
        }
    }
}

Seems to work, any feedback welcome. Cheers!

3
Share New Actions / Set Background Loading Priority
« on: June 14, 2021, 06:17:35 PM »
I kinda hoped this would help me for my slow loading time when using Async Scene Loading action. The action works, but the loading time isn't faster. :)

Still thought to share it here. Maybe it helps someone?

Unity docs:
https://docs.unity3d.com/ScriptReference/Application-backgroundLoadingPriority.html

4
Share New Actions / Resources.LoadAsync with Do Not Spawn option
« on: April 30, 2021, 02:19:47 AM »
I updated the action Resources.LoadAsynch from the Ecobrowser and called it *Async without the "h" as in the official Unity documentation: https://docs.unity3d.com/ScriptReference/Resources.LoadAsync.html

The important change nonetheless, is the addition of a boolean for "Do Not Spawn", exactly as we have it in the normal Resources.Load action.

This is needed when you use a pooling system and want instead to add your resources to your pool or simply don't want to instantiate your resources when you load them.

Feel free to download from here or to add to the Ecobrowser.

5
Official Action Updates / Resources.LoadAll
« on: April 26, 2021, 03:02:46 PM »
So the Resources.LoadAll action from the Ecosystem is broken.

Seems I was able to make it work again. Here's the code:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2020. All rights reserved. 
// License: Attribution 4.0 International(CC BY 4.0)
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/

using UnityEngine;
using System.Linq;

#pragma warning disable 0162 

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Resources")]
[Tooltip("Loads all assets of a given type stored at path in a Resources folder. The path is relative to any Resources folder inside the Assets folder of your project, extensions must be omitted.")]
public class ResourcesLoadAll : FsmStateAction
{
[RequiredField]
[Tooltip("The path is relative to any Resources folder inside the Assets folder of your project.\n\nExample: Assets/Resources/Prefabs/YourFolder\nYou enter: Prefabs/YourFolder")]
public FsmString assetPath;

[RequiredField]
[Tooltip("The Array to store the Assets in")]
[UIHint(UIHint.Variable)]
public FsmArray storeAssets;

public FsmEvent successEvent;
public FsmEvent failureEvent;


public override void Reset()
{
assetPath = null;
storeAssets = null;
}


public override void OnEnter()
{
bool ok = false;
try
{
ok = LoadAllResources();
}catch(UnityException e)
{
Debug.LogWarning(e.Message);
}

if (ok)
{
Fsm.Event(successEvent);
}else{
Fsm.Event(failureEvent);
}

Finish ();
}

public override string ErrorCheck ()
{
if (storeAssets.IsNone)
{
return "";
}

switch (storeAssets.ElementType)
{
case VariableType.GameObject:
break;
case VariableType.Texture:
break;
case VariableType.Material:
break;
    case VariableType.String:
break;
    case VariableType.Object:
break;
default:
// not supported.
return "Only GameObject, Texture, Sprites, Material and Unity Objects are supported";
}

return "";
}

public bool LoadAllResources()
{
switch (storeAssets.ElementType)
{
case VariableType.GameObject:
    storeAssets.Values = Resources.LoadAll<GameObject>(assetPath.Value).Cast<GameObject>().ToArray();
                break;

case VariableType.Texture:
storeAssets.Values = Resources.LoadAll<Texture>(assetPath.Value).Cast<Texture>().ToArray();
break;

case VariableType.Material:
storeAssets.Values = Resources.LoadAll<Material>(assetPath.Value).Cast<Material>().ToArray();
break;

case VariableType.String:
    storeAssets.Values = Resources.LoadAll<TextAsset>(assetPath.Value).Cast<TextAsset>().Select(_asset => _asset.text).ToArray();
break;

case VariableType.Object:
storeAssets.Values = Resources.LoadAll<Object>(assetPath.Value).Cast<Object>().ToArray();
break;

default:
// not supported.
return false;
}
return true;
}
}
}

Somebody else please check, mostly with those types and that errorcheck.

I tested with prefabs (gameobjects) and it's working.

6
Official Action Updates / Array Add Range - Updated or Not?
« on: April 26, 2021, 12:17:52 AM »


Is this action updated or not? The note is confusing...

7
PlayMaker Help / Resources Folder in Playmaker
« on: April 25, 2021, 10:29:19 AM »
Researching more about the function of the Resources folder I understand atm that you can make infinite number of them and place them wherever you want inside your projects Assets folder. As long as it has the name 'Resources' it will be picked up by Unity.

My question here is: why does the Editor folder of Playmaker have 2 Resources folder in it?

This is one of them, the other on is inside the install folder.

8
Action Requests / Action to detect iOS/Android version
« on: March 15, 2021, 03:04:40 PM »
Did find something for device models, but not for OS. Now that Apple is introducing ATT in iOS 14.5+ it would be good to have such an action to detect if user is on this version or later and then do trigger corresponding privacy code.

Is this already available and I missed it? If not, would be cool to have an action like that.

9
So I'm getting this error when exporting my project to iOS but can't figure out how to resolve it:

File contains the same file identifier (3) for multiple object types (PrefabImporter) (MeshCollider). Object may be overwritten.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
HutongGames.PlayMakerEditor.ProjectTools:DoPreprocessPrefabFSMsInBuild () (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:115)
HutongGames.PlayMakerEditor.ProjectTools:PreprocessPrefabFSMs () (at Assets/PlayMaker/Editor/PlayMakerProjectTools.cs:57)
HutongGames.PlayMakerEditor.PlayMakerBuildCallbacks/PlayMakerPreProcessBuild:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport) (at Assets/PlayMaker/Editor/PlayMakerBuildCallbacks.cs:31)
UnityEngine.GUIUtility:ProcessEvent (int,intptr)

I think it has to do with 3D models but not idea why it's somehow connected to Playmaker.

Any help appreciated.
Thanks,
Christoph

10
So I have this issue which I thought first it was related to Easy Save but it's not. It happens with all my global variables.

Basically after setup they disappear until you hit play and they are back at runtime, you stop the game and they are 'gone' again.

Steps to reproduce:
1. create global variable
2. setup action with global variable
3. copy global variable (they disappear)
4. hit play (they are back)
5. hit stop (they are gone again)

Can provide video.
Can as well provide test project.

11
Not sure where to post this so staff feel free to move this to a more appropriate section in the forum.

I would like to hire a good c#/playmaker developer to build a playmaker asset for mobile input. Not sure if I can afford it, but if someone is interested in this, please send me a pm with your quote and lets discuss it here too.

Since I'm coming from Buildbox which everything is mobile first, I realize that there is a huge lack of mobile related stuff when it comes down to Playmaker. A lot of actions are available with external assets like Easy Mobile Pro but when it comes down to input there is none. Playmaker doesn't even have official swipe actions that work in editor for example so this is huge negative for me and I'm struggling a lot with it.  8)

Basically what I would like to do is to make a similar asset to LeanTouch+ but with playmaker actions and ready made prefabs/presets that users can simply re-use for their own use. So it's some kind of base utilities combined with a modular approach of actions that then can be used by users to further expand on the examples provided.

As an alternative, but not sure if this makes sense at all, would be to develop actions for the LeanTouch+ scripts. But I feel things would be cleaner if everything runs through Playmaker itself. :)

Anyone interested to participate in that gig? Any thoughts? Appreciate any kind of feedback.

Cheers!

12
So I am trying to set up an action to check if Internet is available or not, using a coroutine with the "new" UnityEngine.Networking. I got it almost working 100% but for some reason I have one situation that messes with the execution of the code.

This is the code I'm using:
Code: [Select]
using UnityEngine.Networking;
using UnityEngine;
using System.Collections;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Device)]
[Tooltip("Check for internet connection.")]

public class CheckForInternetConnection : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]

        [Tooltip("Send event if internet is available.")]
public FsmEvent internetIsOn;

        [Tooltip("Send event if internet is not available.")]
public FsmEvent internetIsOff;

public override void OnEnter()
{
StartCoroutine(CheckInternetConnection());
}


private IEnumerator CheckInternetConnection()
{
UnityWebRequest www = UnityWebRequest.Get("http://www.msftncsi.com/ncsi.txt");
yield return www.SendWebRequest();

if (www.isNetworkError || www.isHttpError || www.downloadHandler.text != "Microsoft NCSI")
{
Fsm.Event(internetIsOff);
}
else if (www.downloadHandler.text == "Microsoft NCSI")
{
Fsm.Event(internetIsOn);
}
}
}
}
I have set up that action on a button click so I quickly can test if it works or not.

When I open the game while Internet is OFF and I click on the button, it works and returns Internet OFF. I even can turn the Internet ON and click again on the button and it now returns Internet ON as it should.

When I open the game while Internet is ON and I click on the button, it works and returns Internet ON. But... (the problem)

When I disable Internet now and then click again to test if it is OFF, it then just stays forever on the state with the action attached to it and never triggers any of the two events. Like if the coroutine never gets executed completely and stays at the "SendWebRequest" stage.

I then can click again a second time on the button and it works again as expected showing Internet as OFF. It just is that once it has checked already and Internet was ON, it doesn't recognize Internet being OFF the first time, respectively something prevents it from executing the code entirely.

Any idea why this might be happening?

13
PlayMaker Help / Ecosystem Browser Bad Credentials
« on: October 30, 2020, 12:36:39 AM »


Suddenly started to appear. Tried to delete the net.fabrejean folder and re-install the Ecosystem but no luck.

What do I have to do in this situation? And how can I avoid it from happening again?

Thanks.

14
I just installed the Linker Wizard and my project got corrupted. Namely Playmaker got corrupted and it's impossible to keep working with the project because of it.



These errors appear and Playmaker completely disappears from the project. It's not anymore in the top menubar available as it should be.

Now interesting enough, this is actually the second time this happens to my project. The first time it happened after installing the asset "Simple Waypoint System" and it corrupted the project in the same way.

I thought it was a problem of that particular asset and according to the dev he fixed it. Doing so he said:

I am absolutely astonished how importing our additional actions can break the original PlayMaker scripts. Seriously, I have never seen such an issue in 7 years working with Unity.

The corresponding thread can be found here:
https://www.rebound-games.com/forum/topic/2528/import-in-playmaker-project-causes-errors

The problem is that even when I delete the Playmaker folder completely from the project, there are still the actions and other custom scripts that have a reference to the project and until I don't delete all of them (which is basically destroying my entire project) I can't re-install Playmaker successfully.

In short, at least with my limited knowledge, it means that my project just went straight into the trash bin.

Why does this happen? And more importantly, how can it get fixed?

Is this a known issue or am I doing something wrong?

15
PlayMaker Help / Compare two Game Objects by Tag
« on: September 28, 2020, 10:34:07 AM »
Hi,

is it possible to compare two game objects by its tag?

Selecting game object 1 and 2 and then if the tag is the same do something, if not the same, do something else.

Pages: [1] 2