Bug Reporting > PlayMaker Bug Reporting
[SOLVED] NullReferenceException DestroyImmediate
(1/1)
amaranth:
I think this might be a bug that I've found. I updated to 1.3.2 yesterday.
1. I create FSM
2. Add State 1
3. Add State 2
4. In State 1, I add a Trigger Event and link the state to State 2.
5. In State 2, I add a Create Object Event.
6. When I run the game, I get the error below.
7. If I move Create Object to State 1 and put it after Trigger Event, everything runs fine.
8. I closed Unity and reopened. Same issue persisted.
--- Code: ---Destroying object immediately is not permitted during physics trigger and contact callbacks. You must use Destroy instead.
UnityEngine.Object:DestroyImmediate(Object, Boolean)
SmoothMoves.BoneAnimation:CreateComponents()
SmoothMoves.BoneAnimation:CreateAnimation()
SmoothMoves.BoneAnimation:Awake()
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
HutongGames.PlayMaker.Actions.CreateObject:OnEnter() (at Assets/PlayMaker/Actions/2-PlayMaker Scripts/CreateObject.cs:82)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean)
HutongGames.PlayMaker.Fsm:ChangeState(FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEvent)
HutongGames.PlayMaker.Actions.StringCompare:DoStringCompare() (at Assets/PlayMaker/Actions/2-PlayMaker Scripts/StringCompare.cs:61)
HutongGames.PlayMaker.Actions.StringCompare:OnEnter() (at Assets/PlayMaker/Actions/2-PlayMaker Scripts/StringCompare.cs:35)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean)
HutongGames.PlayMaker.Fsm:ChangeState(FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEvent)
HutongGames.PlayMaker.Actions.TriggerEvent:DoTriggerEnter(Collider) (at Assets/PlayMaker/Actions/2-PlayMaker Scripts/TriggerEvent.cs:38)
HutongGames.PlayMaker.Fsm:OnTriggerEnter(Collider)
PlayMakerFSM:OnTriggerEnter(Collider)
--- End code ---
Note: What's strange to me is that DestroyImmediate was called even though I requested to create a new object.
Alex Chouls:
From the log, it looks like the bug is in SmoothMoves:
SmoothMoves.BoneAnimation:CreateComponents()
This is the key info:
Destroying object immediately is not permitted during physics trigger and contact callbacks. You must use Destroy instead.
You'd probably get this error with a script too, so I'd post this on the SmoothMoves forum, or contact the author.
A possible workaround for now, is to delay the CreateObject action, e.g., Use Next Frame Event to transition to a separate CreateObject state in the next update. This should avoid the error, but might introduce a one frame delay (off hand I can't recall if physics callbacks are handled before or after Update in Unity).
amaranth:
Sending him this info now. :)
Yup, that's what I did. I added a .01 wait and it fixed the problem.
Navigation
[0] Message Index
Go to full version