void OnTriggerStay2D(Collider2D other) { /* * When meeting collider with Player, calls for method changeLayer(). */ MainCharacterController controller = other.GetComponent <MainCharacterController>(); if (controller != null) { changeLayer(controller.getPosition(), controller.getLayer()); } }