Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ErayMan

Pages: [1]
1
Quote
It needs to be public to appear in the inspector....

public Transform bullets;

Haha yeah, it slipped my mind... it just goes to show that sometime all you need is to take a step back to see the obvious :)
I'll also look into the transform.position + offset, as the vector.up was just a placeholder for me.

Thanks for your help Unikron; you really are an one man army around here! ;)

2
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:

Code: [Select]
...
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

Pages: [1]