I’m trying to acces to the variables inside of an Array that I’ve created:
[SerializeField] private GameObject[] _hitPoints;
void Start()
{
foreach (GameObject value in _hitPoints)
{
print(value);
}
Debug.Log(_hitPoints.Pop());
}
_hitPoints is:
The foreach
works perfectly, but in the line of _hitPoints.Pop()
I keep getting an error which says:
GameObject[]’ does not contain a definition for ‘Pop’
I’ve read about giving arrays an initial value, but I would really love to have this array as dynamic so _hitPoints (a.k.a the hp of the player) could be bigger or smaller.
Thanks in advance