Hi! I am new to Unity & 2d Toolkit.
I am trying to Instantiate a new Sprite when Space is pressed.
I have a spaceship (which is an AnimatedSprite) and in the script (C#) associated I have:
...
Transform Bullets;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Space))
{
Instantiate(Bullets, Vector3.up, Quaternion.identity);
}
}
...
Now it compiles without problem. If I understand correctly, in the Unity's Inspector, while selecting my AnimatedSprite, I should be able to see "Bullets" as an updatable field and be able to select which gameobject I want to use as "Bullets"
Unfortunatly, I cannot find any trace of "Bullets" anywhere in Unity except in the warning telling me that Bullets is never assigned to and will use default value "null".
How can I assign a gameobject (or a Sprite, I assume?) to my global variable "Bullets" declared in the behavior script of an AnimatedSprite?
Thanks