Help Me with my gun!

When I try to fire a bullet in my game, it says: “UnassignedReferenceException: The variable projectile of ‘gunfire’ has not been assigned.”

Someone previously answered: “You haven’t assigned the actual GameObject in the Inspector to the variable projectile.”

How would I go about doing that?

Seriously? Read a tutorial, there's plenty out there.

@syclamoth I'm sure he is serious. That's what this place is for, asking questions and getting answers. Sarcasm isn't necessary.

1 Answer

1

Drag and drop muh good sir, pull up the game object that has your gunfire script in the inspector tab, it should have a list of variables under it, one of which being projectile if I’m right. To the right of that variable it should say empty

Drag your prefab of what ever you want to shoot from your project tab over the text labled “empty”. Then drop the prefab into it

Im with Eli up there ^^^ :)

Please convert this to a comment, it is not an answer.

Accept this answer so people know this OLD question has been resolved :)

OR close the question.

sorry there clunk47