Can I make a statement apply to all elements of an array? For example. I have an object with multiple colliders. In the right condition, I want the players colliders to ignore all of the colliders in my array, which can very in number. I tried this, but it doesn’t work. Is there an easy to make it work?
usingUnityEngine;
usingSystem.Collections;
publicclassPlatformOneWay : MonoBehaviour
{
publicPlayerLocoplayerLoco;
publicGameObjectplayer;
publicCollider2DplayerCirCollision;
publicCollider2DplayerBoxCollision;
publicbooloneWayCheck = false;
publicCollider2D[] platformColliders;
voidAwake()
{
player = GameObject.FindGameObjectWithTag("Player");
playerLoco = player.GetComponent<PlayerLoco>();
playerCirCollision = player.GetComponent<CircleCollider2D>();
playerBoxCollision = player.GetComponent<BoxCollider2D>();
}
voidUpdate()
{
if(oneWayCheck)
{
Physics2D.IgnoreCollision(platformColliders[], playerBoxCollision);
}