playMaker

Author Topic: [SOLVED]Problem with "Mouse Pick 2D Event" (NullReferenceException)  (Read 2666 times)

Deek

  • Full Member
  • ***
  • Posts: 133
Hey folks,
the problem I'm facing today is that when I try to execute the said Action at runtime i get the following Error:

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Actions.MousePick2dEvent.DoRaycast () (at Assets/PlayMaker/Actions/Physics2D/MousePick2dEvent.cs:103)
HutongGames.PlayMaker.Actions.MousePick2dEvent.DoMousePickEvent () (at Assets/PlayMaker/Actions/Physics2D/MousePick2dEvent.cs:68)
HutongGames.PlayMaker.Actions.MousePick2dEvent.OnUpdate () (at Assets/PlayMaker/Actions/Physics2D/MousePick2dEvent.cs:61)
HutongGames.PlayMaker.FsmState.OnUpdate () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:256)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2618)
HutongGames.PlayMaker.Fsm.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1865)
PlayMakerFSM.Update () (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:509)


This might be because I upgraded from a previous Playmaker Version that had the 'PlaymakerUnity2D.unitypackage' Extension installed, but I deleted that folder since 2D Actions are now part of the official Playmaker Versions.
I now have Playmaker Version 1.8.4 and the GameObject this FSM is attached to has a Sprite Renderer and a Box Collider 2D.

When I click on the Error it references to the highlighted line in the second Attachment.

Since I have no clue what could cause this or how to fix this, I hope someone here can.
« Last Edit: April 22, 2017, 02:52:25 PM by pikmin36 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Problem with "Mouse Pick 2D Event" (NullReferenceException)
« Reply #1 on: April 21, 2017, 03:46:58 PM »
Hi,
Are you using this on unity UI objects? if so, that will not work.

You can get the action for UI on the Ecosystem
Search for 'ugui proxy full' and install the package.

for some tutorials you can check the User Tutorial Wiki Page

Deek

  • Full Member
  • ***
  • Posts: 133
[SOLUTION]Re: Problem with "Mouse Pick 2D Event" (NullReferenceException)
« Reply #2 on: April 22, 2017, 02:51:39 PM »
Hi,
Are you using this on unity UI objects? if so, that will not work.

You can get the action for UI on the Ecosystem
Search for 'ugui proxy full' and install the package.

for some tutorials you can check the User Tutorial Wiki Page

I figured out what caused it. I had no camera in the scene that was tagged as 'MainCamera'; thats what the .DoRaycast() function seems to search for. Now everything works flawlessly.
Still thanks for taking your time to look into this.