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);
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);
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.
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