- Home /
my prefab is null woe
Hey , i'm trying to make my character to shoot , but shows '' The prefab you want to instantiate is null ''
i've type on GunBehaviour :
if (Input.GetButtonDown ("Fire1")) Instantiate(bullet, transform.position, transform.rotation);
Answer by Nidre · Dec 17, 2012 at 09:26 AM
That basicly means what it says.Your bullet GameObject appears to be null.Make sure you have initialized it before using it.its the best answer i can give with that much of code you have provided.
Answer by vinod.kapoor · Dec 17, 2012 at 09:42 AM
First of all declare a variable for bullet before start function
e.g public Transform bullet;
then
if (Input.GetButtonDown ("Fire1")) Transform bullets = Instantiate(bullet, transform.position, transform.rotation) as Transform;
try this
Your answer
Follow this Question
Related Questions
fps shooting enemy 1 Answer
Fire script not working 1 Answer
shooting raycast 1 Answer
How Do I Give Two Objects the Same Transform? 1 Answer
How to make bullets spread in unity2D? 0 Answers