Edit figured it out.
Had to declare a public gameobject shields.
if(other.gameObject.tag ==("PlayerShield"))
{
shieldOn = true;
Destroy(other.gameObject);
}
if(shieldOn == true)
{
shields.SetActive(true);
}
}
I am trying to activate my child obj “ShieldEquip” which has a shield like particle on the empty obj for my player spaceship. I can’t figure out how to activate the shield when the player touches the shield pickup, which turns on Boolean shieldON.
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag ==("PlayerShield"))
{
shieldOn = true;
Destroy(other.gameObject);
}
if(shieldOn == true)
{
GameObject.FindGameObjectWithTag("Shield"). SetActive( true);
}
}
When spaceship collides with shield pickup the Boolean tick box turns on. The second part doesn’t work and I get errors.
Thank you.