FPS Tutorial problem: "prefab is null" and other e

Hi, I’m new to Unity and I’m trying to follow the FPS Tutorial. I completed the first part fine. The second is causing me some problems now.

I have created the rocket launcher and the rocket prefab, and have come to page 6 of the tutorial, but here it goes wrong. When I try to fire a rocket, I get the error:

NullReferenceException: The prefab you want to instantiate is null.

The attached image shows which part of the code the error refers to (in RocketLauncher.js).

Now, the tutorial says: [TODO , hook up the rocket to the rocketlauncher variable].

What I have done is to drag the rocket prefab I created onto the projectile variable in the rocket launcher script (again, see attached image). Is that not what I’m supposed to? Why does the error say that the prefab is null then, and how am I supposed to correct it?

Another error I have gotten is:

Assets/WeaponScripts/FPSPlayer.js(124) error BC0019: ‘frame’ is not a member of ‘UnityEngine.Texture2D’.

This is not a big problem yet, as I’m not using that script, but it’s strange that it generates an error when it’s part of the FPS asset pack.

Thanks in advance,
Rune

I figured this out.

What I didn’t realize was that there is a difference between the projectile variable in the RocketLauncher script itself, and in the components created from the script. The variables in the script itself are called ‘Default references’, but apparently, a component variable with a value of ‘None’ can override a default reference with an actual value. Thus, even though I attached the rocket prefab to the default reference projectile variable of the Rocket Launcher script, the derived component still maintained ‘None’ in its projectile variable. This is what generated the error and caused the confusion for me.

I still don’t know what the other error is about, so I just had to comment it out.

Rune