is there a solution for my problem ? "it is not possible to invoke an expression of type 'int' "
pragma strict
ublic var playerFinish : GameObject;
function OnCollisionEnter2D (playerFinish : Collision2D){ if (playerFinish.collider.tag == "Player"); Application.loadedLevel('1'); }
Answer by Jiji_ · Oct 10, 2015 at 11:03 AM
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')
Your answer
![](https://koobas.hobune.stream/wayback/20220612040745im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
error CS0118 'charanim.CameraTurn' is a field but a 'type' was 'expected' 1 Answer
Error Code CS1519 1 Answer
Unity unable to find %game-name%_Data despite the fact that the folder is there 1 Answer
fatal error checkdisalowAllocation. Allocating memeort when it is not allowed to allocate memory 4 Answers