x


OnTriggerStay not working properly

I have an object that when the player is touching it and they press a keyboard button, it will load a new level, this seems to work in the unity player, but when I do the same thing on the proper thing (Build and run), it doesn't do anything. here's the code:

function OnTriggerStay(other : Collider) {

    if(other.gameObject.CompareTag ("Player")){

        if(Input.GetButtonDown("Activate")){

            Application.LoadLevel(1);

            Screen.lockCursor = false;

        }

    }

}
more ▼

asked Dec 13 '10 at 09:08 AM

MonkeyAssassin8 gravatar image

MonkeyAssassin8
271 35 38 43

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Turns out, changing Input.GetButtonDown to Input.GetButton made it work perfectly

more ▼

answered Dec 14 '10 at 04:19 AM

MonkeyAssassin8 gravatar image

MonkeyAssassin8
271 35 38 43

(comments are locked)
10|3000 characters needed characters left

Only thing I have in mind : Are both level included in Build Settings ?

more ▼

answered Dec 13 '10 at 12:11 PM

Berenger gravatar image

Berenger
11k 12 19 53

no, both levels are definitely there

Dec 14 '10 at 04:03 AM MonkeyAssassin8
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x986
x72
x7

asked: Dec 13 '10 at 09:08 AM

Seen: 1189 times

Last Updated: Dec 13 '10 at 09:08 AM