# my prefab is null woe

**URL:** https://discussions.unity.com/t/my-prefab-is-null-woe/58202
**Category:** Questions & Answers
**Created:** [December 17, 2012, 8:27am UTC](https://discussions.unity.com/t/my-prefab-is-null-woe/58202 "2012-12-17T08:27:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ISISISISISSI](https://avatars.discourse-cdn.com/v4/letter/i/fbc32d/32.png) [@ISISISISISSI](https://discussions.unity.com/u/ISISISISISSI)
#### Post date: [December 17, 2012, 8:27am UTC](https://discussions.unity.com/t/my-prefab-is-null-woe/58202/1 "2012-12-17T08:27:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Nidre](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nidre/32/241699_2.png) [@Nidre](https://discussions.unity.com/u/Nidre)
#### Post date: [December 17, 2012, 9:26am UTC](https://discussions.unity.com/t/my-prefab-is-null-woe/58202/2 "2012-12-17T09:26:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![vinod.kapoor](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@vinod.kapoor](https://discussions.unity.com/u/vinod.kapoor)
#### Post date: [December 17, 2012, 9:42am UTC](https://discussions.unity.com/t/my-prefab-is-null-woe/58202/3 "2012-12-17T09:42:32Z")

</div>

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
