hello … how can you specify the public properties of an object when you instanciate it ?
I have tried something like that but it is not working (i am trying to specify
the “Target” public variable) :
public GameObject projectile;
public float fireRate = 0.5F;
private float nextFire = 0.0F;
void Update() {
if (Input.GetButton("Fire1") && Time.time > nextFire) {
nextFire = Time.time + fireRate;
Instantiate(projectile, transform.position, transform.rotation);
// This is where i have issues
projectile = GetComponents<projectile>();
projectile.Target = "cible";
}
}