I want to load the prefab instead of the gameobject that is in the screen, my code is this one:
using UnityEngine;
using System.Collections;
public class Arma : MonoBehaviour {
public static int municao;
GameObject bullet;
GUIText texto;
// Use this for initialization
void Start () {
bullet = GameObject.Find("Bullet");
municao = 10;
texto = GameObject.Find ("qtdMunicao").GetComponent<GUIText>() as GUIText;
}
// Update is called once per frame
void Update () {
texto.text = municao.ToString ();
if(Input.GetKeyDown("i"))
{
if(municao > 0)
{
Instantiate(bullet, transform.position, transform.rotation);
municao--;
}
}
}
} `