In my game, im trying to make a function where a cloud comes up, but the sprite stays down to look like the sprite is falling.
public Rigidbody2D cloudRb;
oof;
void CreateCloud()
{
oof = Instantiate(cloudImage, new Vector2(Random.Range(-23.42, 12.03), -19), Quaternion.identity);
cloudRb.velocity = new Vector2(0, speed);
Invoke(“DestroyCloud”, 4);
}
void DestroyCloud()
{
Destroy(oof);
}
my var “oof” is trying to get the Instantiate var so the destroy function can destroy the Instantiated part. Is there a easier way to do this? Or am i doing something wrong. This is only my 2nd game on unity so im very knew. Please help if you can