playMaker

Author Topic: GameObject is already being activated or deactivated.  (Read 5590 times)

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
GameObject is already being activated or deactivated.
« on: March 23, 2016, 09:17:19 AM »
I find a weird problem and I can't seem to find the problem.



I have something like this. Basically I activate this UI when I click an object. This is done in another FSM.

This UI basically has a state that if I'm not looking at the UI, it will deactivate itself after 3 seconds, as you can see in the screenshot.

When I do this the first time it works. If I open the UI again, the second time when it has to deactivate I get this:

Quote
GameObject is already being activated or deactivated.
UnityEngine.GameObject:SetActive(Boolean)
HutongGames.PlayMaker.Actions.ActivateGameObject:OnExit() (at Assets/PlayMaker/Actions/ActivateGameObject.cs:79)
HutongGames.PlayMaker.FsmState:OnExit() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:425)
HutongGames.PlayMaker.Fsm:ExitState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2196)
HutongGames.PlayMaker.Fsm:StopAndReset() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1566)
HutongGames.PlayMaker.Fsm:Stop() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1540)
HutongGames.PlayMaker.Fsm:OnDisable() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1527)
PlayMakerFSM:OnDisable() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:478)
UnityEngine.GameObject:SetActive(Boolean)
HutongGames.PlayMaker.Actions.ActivateGameObject:DoActivateGameObject() (at Assets/PlayMaker/Actions/ActivateGameObject.cs:107)
HutongGames.PlayMaker.Actions.ActivateGameObject:OnEnter() (at Assets/PlayMaker/Actions/ActivateGameObject.cs:43)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:200)
HutongGames.PlayMaker.FsmState:OnEnter() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:168)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2155)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2113)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2041)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2171)
HutongGames.PlayMaker.Fsm:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1425)
PlayMakerFSM:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:435)

This is how Deactivate UI looks:



I also had to add a wait 0.1 like this:


Because if I don't do it it will just infinite loop. Also no idea why.

I also have no idea why the error has that C:/Users/Alex ... who is Alex? :D
« Last Edit: March 23, 2016, 09:20:14 AM by PET »
Technical Game Designer
www.GamerPET.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: GameObject is already being activated or deactivated.
« Reply #1 on: March 23, 2016, 02:11:51 PM »
Hi,
I Noticed that "reset on exit" are checked on the "Activate Game Object" Actions

This will reset the value when you go to the next state.

the  infinite loop is because of the mouse pick event
it is looping 1000+ times in a single frame between you states when you mouse is over the object, what you can do is add a "Mouse Pick event" instead of the wait 0.1
and set Mouse off

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: GameObject is already being activated or deactivated.
« Reply #2 on: March 24, 2016, 04:48:29 AM »
Hi,
I Noticed that "reset on exit" are checked on the "Activate Game Object" Actions

This will reset the value when you go to the next state.

the  infinite loop is because of the mouse pick event
it is looping 1000+ times in a single frame between you states when you mouse is over the object, what you can do is add a "Mouse Pick event" instead of the wait 0.1
and set Mouse off

Thanks. I thought that the reset on exit was reseting the state when I click "stop" in Unity.

I did a test 2 days ago where I change a texture on a mesh... and that change was permanent.
Technical Game Designer
www.GamerPET.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: GameObject is already being activated or deactivated.
« Reply #3 on: March 24, 2016, 02:19:08 PM »
Hi,
That's strange, normally anything what happens while playing is reset
except things safed / loaded into playerprefs.

PET

  • Full Member
  • ***
  • Posts: 139
    • GamerPET
Re: GameObject is already being activated or deactivated.
« Reply #4 on: April 08, 2016, 04:19:34 AM »
Check this out:



I have about 3 game objects (FSM) like this... same material, different texture. When I click stop, the texture remains on the material :P
« Last Edit: April 08, 2016, 04:25:02 AM by PET »
Technical Game Designer
www.GamerPET.com