Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Argument Exception breaking game

Discussion in 'Editor & General Support' started by Palette, Dec 2, 2015.

  1. Palette

    Palette

    Joined:
    Sep 4, 2015
    Posts:
    2
    I recently imported a plugin (Pool Manager) and it seems to be conflicting with existing plugins (PlayMaker and EasyTouch). Basically, an argument exception is thrown when it never used to be. This doesn't crash the game but breaks it unfortunately.

    Let me know what other info I can provide. I have replicated this with a clean repo clone on a separate user account. I have also attempted a Unity reinstall. My development partner does not seem to experience this issue on his end, so maybe it's a local issue? The argument exception is also thrown inconsistently.

    Thank you, here is the console log:

    Code (CSharp):
    1. ArgumentException: An element with the same key already exists in the dictionary.
    2. System.Collections.Generic.Dictionary`2[System.String,UnityEngine.Transform].Add (System.String key, UnityEngine.Transform value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    3. PathologicalGames.PrefabsDict._Add (System.String prefabName, UnityEngine.Transform prefab) (at Assets/Plugins/PathologicalGames/PoolManager/SpawnPool.cs:2100)
    4. PathologicalGames.SpawnPool.CreatePrefabPool (PathologicalGames.PrefabPool prefabPool) (at Assets/Plugins/PathologicalGames/PoolManager/SpawnPool.cs:359)
    5. PathologicalGames.SpawnPool.Spawn (UnityEngine.Transform prefab, Vector3 pos, Quaternion rot, UnityEngine.Transform parent) (at Assets/Plugins/PathologicalGames/PoolManager/SpawnPool.cs:560)
    6. PathologicalGames.SpawnPool.Spawn (UnityEngine.Transform prefab, Vector3 pos, Quaternion rot) (at Assets/Plugins/PathologicalGames/PoolManager/SpawnPool.cs:596)
    7. HutongGames.PlayMaker.Actions.PmtSpawn.DoSpawn () (at Assets/PlayMakerCustomActions/Path-o-logical/PoolManager2/PmtSpawn.cs:86)
    8. HutongGames.PlayMaker.Actions.PmtSpawn.OnEnter () (at Assets/PlayMakerCustomActions/Path-o-logical/PoolManager2/PmtSpawn.cs:55)
    9. HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
    10. HutongGames.PlayMaker.FsmState.OnEnter ()
    11. HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
    12. HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
    13. HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
    14. HutongGames.PlayMaker.Fsm.Start ()
    15. HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
    16. HutongGames.PlayMaker.Fsm.BroadcastEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, Boolean excludeSelf)
    17. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
    18. HutongGames.PlayMaker.Actions.SendEvent.OnEnter () (at Assets/PlayMaker/Actions/SendEvent.cs:39)
    19. HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
    20. HutongGames.PlayMaker.FsmState.OnEnter ()
    21. HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
    22. HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
    23. HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
    24. HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
    25. HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
    26. HutongGames.PlayMaker.Fsm.BroadcastEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, Boolean excludeSelf)
    27. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
    28. HutongGames.PlayMaker.Actions.SendEvent.OnEnter () (at Assets/PlayMaker/Actions/SendEvent.cs:39)
    29. HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
    30. HutongGames.PlayMaker.FsmState.OnEnter ()
    31. HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
    32. HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
    33. HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
    34. HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
    35. HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
    36. HutongGames.PlayMaker.Fsm.BroadcastEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, Boolean excludeSelf)
    37. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
    38. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, System.String fsmEventName)
    39. HutongGames.PlayMaker.Actions.SendEventByName.OnEnter () (at Assets/PlayMaker/Actions/SendEventByName.cs:37)
    40. HutongGames.PlayMaker.FsmState.ActivateActions (Int32 startIndex)
    41. HutongGames.PlayMaker.FsmState.OnEnter ()
    42. HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
    43. HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
    44. HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
    45. HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
    46. HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
    47. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
    48. HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEvent fsmEvent)
    49. HutongGames.PlayMaker.Actions.EasyTouchTouch.HandleOn_TouchUp (.Gesture gesture) (at Assets/EasyTouchBundle/EasyTouch/EasyTouchPlaymakerActions/EasyTouchTouch.cs:309)
    50. EasyTouch.RaiseEvent (EventName evnt, .Gesture gesture) (at Assets/EasyTouchBundle/EasyTouch/Plugins/EasyTouch.cs:1361)
    51. EasyTouch.CreateGesture (Int32 touchIndex, EventName message, .Finger finger, SwipeDirection swipe, Single swipeLength, Vector2 swipeVector) (at Assets/EasyTouchBundle/EasyTouch/Plugins/EasyTouch.cs:818)
    52. EasyTouch.OneFinger (Int32 fingerIndex) (at Assets/EasyTouchBundle/EasyTouch/Plugins/EasyTouch.cs:744)
    53. EasyTouch.Update () (at Assets/EasyTouchBundle/EasyTouch/Plugins/EasyTouch.cs:507)
     
  2. Kamilche_

    Kamilche_

    Joined:
    Jan 11, 2015
    Posts:
    75
    Reading it from the bottom up, it appears PlayMaker is broadcasting an event, which causes something to spawn from PathologicalGames, and when it's spawned, it's added to the PrefabsDict. That key already exists in the dictionary. So whatever it's adding, already exists.

    That implies duplicate resource loading. Look for multiple gameObjects all causing the same resource to be loaded. You could also put a debug line on line 2100 of Spawn Pool, and see the key of the prefab that was being added to the pool, this often narrows down the problem.