I have multiple objects, that deal damage with the colliders, although I get a lot of errors and null stuff.
Original code was simply:
////Grab damage of collision
damage = other.gameObject.GetComponent("Z95Projectile").damage;
damage = other.gameObject.GetComponent("MediumExplosion").damage;
damage = other.gameObject.GetComponent("SmallExplosion").damage;
Failed attempted solution:
////Grab damage of collision
damage = other.gameObject.GetComponent("Z95Projectile").damage;
if (damage == null)
{
damage = other.gameObject.GetComponent("MediumExplosion").damage;
if (damage == null)
{
damage = other.gameObject.GetComponent("SmallExplosion").damage;
if (damage == null) {
//later
} } }
This answer sort of helped, but not completely, because i am trying to use multiple different scripts, not players.