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.


Messages - Christoph

Pages: [1] 2 3 ... 6
1
PlayMaker Help / Re: Dynamically change FSM throughout Prefabs
« on: July 30, 2021, 10:48:23 AM »
No, what's it for?

2
PlayMaker Help / Re: FSM Variable Output <SOLVED>
« on: July 30, 2021, 10:47:45 AM »
Is the new documentation already available? I'm trying to understand both, templates and inputs/outputs. I'm trying to have one FSM on hundreds of level prefabs that use individual variables (in a c# script it would be a public variable).

Do I do this with templates and inputs variables?

3
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.

4
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!

5
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

6
Share New Actions / Re: Cinemachine Support [ECOSYSTEM] [MAY 2020]
« on: June 05, 2021, 05:19:14 PM »
Are there actions for the Noise part of Cinemachine?

I would like to do camera shakes like explained here:

7
Hi. I will need more support with this to understand exactly what to do with the profiler. Because it doesn’t show anything when that black screen happens.

Scene loads really fast when adding a second scene for loading bar only. I pointed that out to Alex as well. The problem is not my scene or assets. It actually seems to be Playmaker itself. Even with an empty scene the game always shows the black screen.

I even did a test with an empty project. Playmaker + 100 Empty FSMs already add 1sec of black screen.

My project doesn’t have lots of assets at all but I now load them all from resources async and don’t instantiate them at start. So that doesn’t affect it either anymore.

Black screen still there.

Checked with other devs for mobile. Their games have all the same problem. Black screen.

8
Yeah but Unity says this because if you start to put everything in Resources folders you will have huge build size and if you then use Resources.LoadAll, you will increase your loading times of course.

Plus there was for a long time AssetBundles as a better alternative and now even better Addressables.

But tbh, both, AssetBundles and Addressables is overkill for my needs, so resources works pretty good besides that problem of not being able to pull those paths automatically.

Either way, that black screen is appearing with or without Resources folder.  :o

9
Hi Jean,

thanks for taking the time to reply.

I did actually change to Resources and it indeed did reduce the black screen a bit and I'm able now to show the first scene or the main scene's UI at around 50% of the complete loading time. That is on the worst device I have available to test on. On other more powerful devices the black screen takes up more percentage in time but overall it loads as well much faster so it's not as much of an issue there.

But I do think it's important to point out that the overall loading time didn't improve. I'm just able to show much quicker the first scene's UI (which is nice for showing a Loading screen).

On my low end Android test device, that black screen still makes up about 5-6 seconds. So I have now 4 seconds Splash screen, then 5-6 seconds black screen, then another 8 seconds showing the UI loading screen.

Note: this is with Resources.LoadAll action without instantiating the prefabs at start up. I'm now in the process of using instead Resources.LoadAsync but this has quickly become a headache in terms of logic because all is based on string arrays that need to be done manually and is extremely prone to error. I wished there is an editor script that can list the prefabs inside a Playmaker array automatically.

When I use a separate scene to show the loading screen it actually takes about 2 seconds more to open the entire game. I guess it has to do with the change of scene.

Also, I have almost no logic in the Start States. There are some variable setups that I found easier to do in a dedicated SETUP state at Start (like color variables) or I enable the Loading Screen canvas, but otherwise not much going on there.

I then use a Core Manager to organize the flow of loading and preparing all needed things in my game and only move on if X task is completed. Like I load first the resources of the current level, and only if those are finished loading, I move on to create the level. But as said above, this part is rather working great and is pretty fast.

What I can't get rid of is that black screen and can't understand how other games are able to show their first scene's UI immediately.

I also did couple of days ago several tests to measure the loading time. All those tests only had a Canvas in the project. Here's the finding:

Clean Unity Project = 4:07 seconds loading time / Black Screen 0:20 seconds
With Playmaker = 4:13 seconds loading time / Black Screen 0:20 seconds
With 100FSM = 5:03 seconds loading time / Black Screen 1:09 seconds

So by adding FSMs the black screen actually already increased by 100%.

I didn't take the tests further because I didn't had the time but I guess if I added logic to those FSMs it would further increase?

Regarding the profilers, in editor profiler as far as I know, it doesn't show what happens before the scene loads (it's just empty at that point). When the scene does load though I do have a huge spike. But I guess this is normal since all FSMs Start methods are firing at the same time? There's also some editor stuff spiking hard so I never really understood how to read it.

I did had some Android logcats but I already deleted them again. Again, I didn't really understand how to read them. I did the same as well in Xcode Profiler, but couldn't read it either...

Edit: and I don't have any sound in my project yet. So sound files are a non issue here.

10
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.

11
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.

12
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...

13
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.

14
PlayMaker Help / Re: Black Screen after Unity Splash for a few seconds
« on: April 25, 2021, 12:43:32 AM »
in your case, you should use Resources and load stuff by name, where the name was constructed using logic. like :"level"+levelnumberint
What’s the logic of prefabs in resources folder related to Playmaker?

I have literally the exact same situation like the OP. It almost is scary how much alike my situation is. But there’s one difference it seems: if I put an empty scene as my first scene to load a logo or loading bar, the black screen does NOT go away.

Not sure if something changed with how the prefabs are managed by playmaker since there were many updates related to prefabs recently. But at this moment I highly doubt that the resources folder will fix my problem. Will keep trying tomorrow.

I moved all of my level prefabs to the Resources folder and I used Resource load instead of creating gameobject action, and it's fixed! I didn't change the logic, the FSM is still messy :) But resource folder worked.
I know this is an old thread and seems you haven’t been active since then but did this really fix it for good? Would appreciate any help to solve this too.

15
PlayMaker Help / Re: Resources.Loadall[SOLVED]
« on: April 24, 2021, 04:40:10 PM »
Got this confirmed by Brokn on discord that this action is broken (pun intended). Can we get a fix?

Pages: [1] 2 3 ... 6