- Home /
Enemy list wont update
hey so i have made this list but it wont update the enemies when there spawns some new enemies and i have placed it into the update void can someone help me ?
enemies = new List<GameObject>()
{
StoneGolem,
SkeletonWarrior,
SkeletonArcher
};
Can you provide a bit more information on what you're trying to accomplish? $$anonymous$$aybe your Update function and how you expect the list to change when things spawn?
When i play the game and look at the list in the inspector and spawn 3 stone golems it will only say there is 1 and i want it to see all 3 because i have a target finder and here is my whole update function
public void Update()
{
TargetFinder();
#region Random Damage Updater
_randomDamage = Random.Range(_start$$anonymous$$inLaserDamage, _start$$anonymous$$axLaserDamage);
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Space))
{
Debug.Log(_randomDamage);
}
#endregion
#region Orb Rotation Updater
_timer += Time.deltaTime;
transform.Rotate(0, currentRotationSpeed * Time.deltaTime, currentRotationSpeed * Time.deltaTime);
#endregion
#region Orb Height And Speed Updater
tempPos = posOffset;
tempPos.y += $$anonymous$$athf.Sin(Time.fixedTime * $$anonymous$$athf.PI * currentSpeed) * currentHeight;
transform.position = tempPos;
#endregion
#region Enemy List
enemies = new List<GameObject>()
{
StoneGolem,
SkeletonWarrior,
SkeletonArcher
};
#endregion
}
Well nothing in here is spawning anything? You're also reassigning that list with every Update call, so it's a bit difficult to work out your problem.
How do you want that enemy list to behave? Is that a list of things that all need to be spawned, or is it just storing the types of enemies you want to spawn and then you'll pick one randomly?
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
I kill all myenemies instead of one 1 Answer
Updating second variable inside a list using c# scipt 1 Answer
Array Help 2 Answers
Get First Object In List 2 Answers