could anyone explain me why this code doesn’t work?
This script is basicly for a ladder.
public class LadderControll : MonoBehaviour {
public CharacterController controller;
public GameObject player;
void Start(){
player = GameObject.Find("Player");
controller = player.GetComponent<CharacterController>();
}
void OnTriggerEnter(Collider other){
if (other.gameObject.name == "Player"){
controller.slopeLimit = 95;
}
}
void OnTriggerExit(Collider other){
if (other.gameObject.name == "Player"){
controller.slopeLimit = 45;
}
}
}
thanks in advance!
have you thrown a couple of Debug.Logs in to make certain that other.gameObject.name is in fact reading as "Player"?
– jmatthewsIt reads well, the problem is just that OnTriggerExit returns nothing, its like it just doesn't work..
– BrumDoes anyone have an answer for this? OnTriggerExit is not returning anything.
– BrumRigidbody attached to the thing with this script on it. Collider set to isTrigger.
– whydoidoitJust to be clear, you dropped a debug statement in each event, each event is firing and printing the debug statement and returning the tag or name you're expecting?
– jmatthews