This post has been wikified, any user with enough reputation can edit it.
Question by
IshanCK · Apr 19, 2017 at 12:58 AM ·
c#unity 2derror messagevoid
unexpected void error
Hey Guys / @username,
My void start() has an error saying unexpecting void
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// add rigidbody 2d and circle collider 2d and change radis to 0.07
public class Player : MonoBehaviour
{
public int power = 500;
public int jumpHeight = 1000;
public bool isFalling = false
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
GetComponent().AddForce (Vector2.right * power);
}
}
Comment
Best Answer
Answer by SohailBukhari · Apr 19, 2017 at 06:40 AM
you are just missing ; here public bool isFalling = false
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// add rigidbody 2d and circle collider 2d and change radis to 0.07
public class Player : MonoBehaviour
{
public int power = 500;
public int jumpHeight = 1000;
public bool isFalling = false;// here semicolon was missing
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
GetComponent().AddForce (Vector2.right * power);
}
}