playMaker

Author Topic: Core Gamekit/Pool Boss trouble  (Read 893 times)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Core Gamekit/Pool Boss trouble
« on: July 19, 2018, 08:02:30 AM »
Hi guys, i wrote on Brian's forum, but i'll post it here too since it's probably a Playmaker issue (which has CGK actions), since it's working fine (in PM 1.8.5 and Unity 2017.2.0f3) until i update it to 1.9.0, but i might as well check it out here too. Things get screwed up in both Unity 2017.2.0f3 and 2018.2. 999 errors appear as soon as i hit play, and here they are:


Code: [Select]
Pool Boss has not initialized (does so in Awake event and may take additional frames if you configured it that way) and is not ready to be used yet. Check that PoolBoss.IsReady returns true before calling other methods.
IsReady is private so i don't know how to check it.

Code: [Select]
Could not spawn: xyz
Code: [Select]
No game object specified for 'Other Object For Position'
Code: [Select]
Coroutine couldn't be started because the the game object 'xyz (Clone x)' is inactive!
Pools are filled, Playmaker works, the game works, prefabs are being spawned from pool, even though allow instantiate more is disabled, all the references and hash tables i draw my data from are intact, nothing seems out of the ordinary. And yet, the moment i hit play, 999 errors appear.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #1 on: July 19, 2018, 01:13:31 PM »
Sorry, forgot the stack

Code: [Select]
Pool Boss has not initialized (does so in Awake event and may take additional frames if you configured it that way) and is not ready to be used yet. Check that PoolBoss.IsReady returns true before calling other methods.
UnityEngine.Debug:LogError(Object)
DarkTonic.CoreGameKit.LevelSettings:LogIfNew(String, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:1231)
DarkTonic.CoreGameKit.PoolBoss:Spawn(Transform, Vector3, Quaternion, Transform) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:656)
DarkTonic.CoreGameKit.PoolBoss:SpawnInPool(Transform, Vector3, Quaternion) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:386)
CoreGameKitPoolBossSpawn:SpawnOne() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:103)
CoreGameKitPoolBossSpawn:OnEnter() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:41)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1925)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2212)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2375)
HutongGames.PlayMaker.Fsm:Event(FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2456)
PlayMakerFSM:OnDisable() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:631)
UnityEngine.GameObject:SetActive(Boolean)
DarkTonic.CoreGameKit.SpawnUtility:SetActive(GameObject, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/SpawnUtility.cs:137)
DarkTonic.CoreGameKit.PoolBoss:InstantiateForPool(Transform, Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:218)
DarkTonic.CoreGameKit.PoolBoss:CreatePoolItemClones(PoolBossItem, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:320)
DarkTonic.CoreGameKit.PoolBoss:ContinueInit() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:182)
DarkTonic.CoreGameKit.PoolBoss:Initialize() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:153)
DarkTonic.CoreGameKit.PoolBoss:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:127)


Code: [Select]
Assertion failed: Assertion failed on expression: 'go.IsActive() && go.GetTag() != 0'
UnityEngine.Camera:get_main()
HutongGames.PlayMaker.Actions.IsVisibleInCameraFrustrum:DoIsVisible() (at Assets/PlayMaker Custom Actions/GameObject/IsVisibleInCameraFrustrum.cs:84)
HutongGames.PlayMaker.Actions.IsVisibleInCameraFrustrum:OnEnter() (at Assets/PlayMaker Custom Actions/GameObject/IsVisibleInCameraFrustrum.cs:52)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1925)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2212)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2375)
HutongGames.PlayMaker.Fsm:Event(FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2456)
PlayMakerFSM:OnDisable() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:631)
UnityEngine.GameObject:SetActive(Boolean)
DarkTonic.CoreGameKit.SpawnUtility:SetActive(GameObject, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/SpawnUtility.cs:137)
DarkTonic.CoreGameKit.PoolBoss:InstantiateForPool(Transform, Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:218)
DarkTonic.CoreGameKit.PoolBoss:CreatePoolItemClones(PoolBossItem, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:320)
DarkTonic.CoreGameKit.PoolBoss:ContinueInit() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:182)
DarkTonic.CoreGameKit.PoolBoss:Initialize() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:153)
DarkTonic.CoreGameKit.PoolBoss:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:127)

Code: [Select]
Could not spawn: RandomDebris
UnityEngine.Debug:LogError(Object)
CoreGameKitPoolBossSpawn:SpawnOne() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:105)
CoreGameKitPoolBossSpawn:OnEnter() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:41)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1925)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2212)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2375)
HutongGames.PlayMaker.Fsm:Event(FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2456)
PlayMakerFSM:OnDisable() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:631)
UnityEngine.GameObject:SetActive(Boolean)
DarkTonic.CoreGameKit.SpawnUtility:SetActive(GameObject, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/SpawnUtility.cs:137)
DarkTonic.CoreGameKit.PoolBoss:InstantiateForPool(Transform, Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:218)
DarkTonic.CoreGameKit.PoolBoss:CreatePoolItemClones(PoolBossItem, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:320)
DarkTonic.CoreGameKit.PoolBoss:ContinueInit() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:182)
DarkTonic.CoreGameKit.PoolBoss:Initialize() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:153)
DarkTonic.CoreGameKit.PoolBoss:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:127)

Code: [Select]
No game object specified for 'Other Object For Position'
UnityEngine.Debug:LogError(Object)
CoreGameKitPoolBossSpawn:SpawnOne() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:95)
CoreGameKitPoolBossSpawn:OnEnter() (at Assets/Plugins/DarkTonic/CoreGameKit/PlaymakerCustomActions/CoreGameKitPoolBossSpawn.cs:41)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1925)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2212)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2375)
HutongGames.PlayMaker.Fsm:Event(FsmEvent) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2456)
PlayMakerFSM:OnDisable() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:631)
UnityEngine.GameObject:SetActive(Boolean)
DarkTonic.CoreGameKit.SpawnUtility:SetActive(GameObject, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Utility/SpawnUtility.cs:137)
DarkTonic.CoreGameKit.PoolBoss:InstantiateForPool(Transform, Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:218)
DarkTonic.CoreGameKit.PoolBoss:CreatePoolItemClones(PoolBossItem, Boolean) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:320)
DarkTonic.CoreGameKit.PoolBoss:ContinueInit() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:182)
DarkTonic.CoreGameKit.PoolBoss:Initialize() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:153)
DarkTonic.CoreGameKit.PoolBoss:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:127)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #2 on: July 19, 2018, 11:08:25 PM »
Well, Brian says PM actions trigger before poolboss is initialized, but there were no problems prior to update. hm.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Core Gamekit/Pool Boss trouble
« Reply #3 on: July 20, 2018, 01:07:50 AM »
Hi,

 you can forward contact to me, and I'll take over with Brian to solve this problem.

 Bye,

 Jean

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #4 on: July 20, 2018, 01:13:09 AM »
Sure Jean,

I'll send it to PM. Thanks. In the meanwhile, i'll try looking into itm

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #5 on: July 20, 2018, 04:01:32 AM »
Ah, here's the thing, i don't know if it is a bug or unwanted behaviour.

I tried disabling all the objects in the scene view that contain any FSM components same thing happens. I wandered around logs and tried some playmaker debugging, and here's how it goes:

1. PoolBoss instantiates an Object 1 which is in the PoolBoss. Object is deactivated of course.

2. Object 1 has an FSM, which is NOT DISABLED, but SHOULD NOT start processing while object is not active, at least that was the case in 1.8.5 i worked in.




3. FSM on Object 1 has Core Game Kit Pool Boss Spawn action that should spawn Object 2, but i get
"Could not spawn Object 2" error.

Anyway, FSM's shouldn't actually fire at all while the gameobject is deactivated as far as i know. I don't know if Unity changed something, or Brian changed something, but if the objects in the pool are active in the project, and then pooled on runtime, are they instantiated then deactivated, or are they instantiated deactivated? I don't know, i've asked Brian about that too.

It makes sense to me that object active in the project will be instantiated as active then deactivated, but why is this happening in latest version and not in 1.8.5?
« Last Edit: July 20, 2018, 07:15:35 AM by krmko »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #6 on: July 20, 2018, 09:16:00 AM »
Well, here's what he says:

I don't believe you can instantiate deactivated. Clones are instantiated and then immediately deactivated afterward. What happens is awake gets called in each thing that's instantiated, also on disabled will get called. The stack Trace shows that FSM is getting entered during the awake and your initial state is trying to do a pool boss custom action. But pool boss is not done being instantiated.

I'll try it out in a fresh project too.
« Last Edit: July 20, 2018, 09:17:43 AM by krmko »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #7 on: July 20, 2018, 01:37:01 PM »
I tested it in empty project with only two objects pooled, and yes, i get the pool boss initialization thing if i spawn things too fast, and that's ok, but i don't understand how come that doesn't appear in earlier versions. I checked if logging is enabled in pool boss, everything is exactly the same.

Here's the thing, FSM starts on a pooled item in 1.9.0, and it doesn't start in 1.8.5.

« Last Edit: July 20, 2018, 02:03:19 PM by krmko »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Core Gamekit/Pool Boss trouble
« Reply #8 on: July 23, 2018, 12:57:28 AM »
Hi,

 yes, that's odd indeed... it could bbe that things inside the action needs to be moved inside the Awake() and not inside OnEnter()

Bye,

 Jean

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Core Gamekit/Pool Boss trouble
« Reply #9 on: July 23, 2018, 01:31:55 AM »
I'll try it out myself, but be sure to contact Brian anyway since everyone with 1.9.0 will have the same problem, making the plugin useless.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14400
  • Official Playmaker Support
    • View Profile
Re: Core Gamekit/Pool Boss trouble
« Reply #10 on: July 25, 2018, 12:50:45 AM »
Hi,

 ok, I looked at the project and your scene, I could repro this.

- I could not revert to 1.8.5 as I was loosing all the core game kit settings. Can you send me the project using 1.8.5?

in all cases, I think your logic is dangerous within a pooling environment, doing something on Fsm start means you take the risk for this to be executed when the pooling system is creating instances that are not supposed to be live but simply as a preload. in your case, the prefab is created and then straight away stored in its pool waiting to be spawn.

 in that context, trying to spawn another pool item is not recommended. Can you explain what you are trying to achieve here?

 as a rule that I use for all projects where I use pooling. The instance doesn't do much on start and instead has its on custom INIT event that is called byt he game Manager or at least the logic responsible for spawning that instance, this way it avoids the clash of logic when the pooling system is creating the instance for the first time in preparation of the pool, not for spawning it. I suggest you take a similar approach to avoid any problems like this one.


 Having said that I created an action that check is PoolBoss is ready. I'll send a mail to Brian, maybe he can include that action and cover more of the api so that these cases can be elegantly solved.

Bye,

 Jean


ps: what's likely happening is that the internal design of PlayMaker and improvement over the old 1.8.5 is that OnEnter is called sooner than before, and this would explain why there is a conflict now since OnEnter is called sooner, PoolBoss is not ready yet.