#pragma strict
public var playerFinish : GameObject;
function OnCollisionEnter2D (playerFinish : Collision2D){
if (playerFinish.collider.tag == “Player”);
Application.loadedLevel(‘1’);
}
#pragma strict
public var playerFinish : GameObject;
function OnCollisionEnter2D (playerFinish : Collision2D){
if (playerFinish.collider.tag == “Player”);
Application.loadedLevel(‘1’);
}
I don’t really have much experience in JavaScript. But what I see is this right?
public var playerFinish : GameObject;
function OnCollisionEnter2D (playerFinish : Collision2D){
if (playerFinish.collider.tag == "Player");
Application.loadedLevel('1'); }
I am not sure but in C# there will be an error because of the IF condition (I think it should be like that)
function OnCollisionEnter2D (playerFinish : Collision2D){
if (playerFinish.collider.tag == "Player") //without the semi colon
Application.loadedLevel('1'); }
Tell me if it made any difference Good luck
EDIT:
So after looking carefully at your code you used
Application.loadedLevel('1')
And that’s an expression of type int…
What I think you should do is
Application.LoadLevel('1')