- Home /
access instantiated object variable
I am making a top down shooter game. Enemy planes spawn from top of the screen. My problem is that enemies die at the same time. How can I access clones variables?
// Update is called once per frame
void Update()
{
spawn += Time.deltaTime;
spawnrate += Time.deltaTime;
spawnrate1 += Time.deltaTime;
if (spawn < 10)
{
if (spawnrate > 2)
{
klon = Instantiate(çöp, spawnpoint.position, Quaternion.identity) as GameObject;
spawnrate = 0;
}
if (spawnrate1 > 2)
{
klon1 = Instantiate(çöp, spawnpoint1.position, Quaternion.identity) as GameObject;
spawnrate1 = 0;
}
}
if (spawn == 30)
{
spawn = 0;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How Do I Access and Change Items in a List on Another Script? 2 Answers
Why is my Prefab Instantiating when the Scene is Loaded? 2 Answers
Using multiple yields in a Coroutine 1 Answer
Objects seemingly not being instantiated after touch. 1 Answer
How to move Instantiated 2D objects by 0.5 using arrows(or mouse) 1 Answer