Hey
I’ve been working on a script which allows me to active an animation by interacting with a button. Ideally I’d like the player to use “E” to activate/press the button. (The characters )
I’ve created the button, added a box collider to detect the player and attached the animation… I’ve create the script which compiles with no errors… But nothing happens once I test/play the game… (execpt for the “OnTriggerExit” function)
Here’s my script so far:
#pragma strict
var clip : AnimationClip;
var clip2 : AnimationClip;
function Start () {
}
function OnTriggerStay (other : Collider) {
if (other.CompareTag (“Player”)){
Away from computer so can’t trial anything but maybe one of the following could help (all just ideas)
1 change get key down to key up
2 keycode.e instead of “E”
3 try setting a variable to true in ontriggerenter then in the update frame you can use if(theVariable) then if (keycode.e) etc…