Author Topic: Unassigned Reference Exception  (Read 1118 times)


  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Unassigned Reference Exception
« on: November 04, 2015, 01:46:42 PM »
Hi everyone,

I'm not sure if this is a Playmaker specific issue, but I'm getting this message:
UnassignedReferenceException: The variable adCanvas of AdCanvasActivate has not been assigned. You probably need to assign the adCanvas variable of the AdCanvasActivate script in the inspector.

What I am trying to do:
-Have one object in charge of spawning clickable clouds.
-When the cloud is clicked the game pauses (working) and enables a canvas asking the player if they would like to watch an ad for a reward.
-Since I've had no luck activating/deactivating game objects through many PlayMaker means, I'm running a script on a separate object that gets the public canvas and buttons and their components and enables them. (I've used an almost identical script that controls all of the front end menus perfectly.)
-Eventually this will play a Unity ad, but I haven't gotten that far yet.

What I don't understand is that the object running the script has all of it's necessities linked in the inspector. All of the other FSM behaviour is working, but it skips Invoking Method because of the error being thrown. Even more odd is that it worked briefly and activated the canvas, but none of the buttons were active. Once I went back into the script to activate the buttons it stopped working. I feel like I'm missing a small detail somewhere.

Initially I had the canvas enabling on the ad cloud object itself once it has spawned in, but since it destroys itself after being clicked it couldn't continue to run the canvas script.

What I have tried (or, at least, that I remember trying):
-Using Playmaker exclusively to activate a game object (canvas and child buttons) on click.
-Creating a script on an object to activate the canvas/buttons instead.
-Having a different object run the script.
-Renaming objects.
-Recreating FSMs and prefabs.
-Storing the canvas in a gameobject variable and calling that gameobject to enable in FSM.

I saved a few screenshots as well that you can find here:

I think I've just been looking at it for too long!
Any help would be greatly appreciated!


  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Unassigned Reference Exception
« Reply #1 on: November 04, 2015, 06:50:40 PM »
I did some further testing to try to figure this out.

I rebuilt the entire system on fresh objects in a fresh scene. Everything worked as intended, and once I had that working I prefabbed the objects to see if that was the issue.  I do believe the problem is originating from the objects being prefabbed.