Hi uhm so Im new to unity and I finally figured out on how to make a Player controller with a bit help from Brackeys. So it tells me that I should put “}” somewhere so I wanted to ask if anyone can help me.
heres the script:
using UnityEngine;
public class PlayerMovement : MonoBehaviour
public Rigidbody rb;
public float ForwardForce = 500f;
public float SidewardsForce = 500f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
if (Input.GetKey(“w”)) ;
{
rb.AddForce(0, 0, ForwardForce * Time.deltaTime);
Are you using an IDE? The IDE should have told you exactly what the problem was right away. It would put a red squiggly line right under that unexpected semi-colon or missing opening bracket. Or maybe you are using an IDE and it told you that it “expects a ‘}’” character? If so, keep in mind that the message an IDE or Unity might post is not always 100% explicit. It might not say, “A semi-colon is invalid here”. Instead, it might say, "I expected an end-bracket ‘}’ character before the end-of-statement, but didn’t see it. This is because the compiler sees that you have an “if(something)” statement, and it expects to see brackets following it, but you also put a semi-colon, which is interpreted as “this is the end of the statement”. As a result, it says "Well, I went to the end of the statement and never saw any of the expected brackets, so I will tell the person that I expected a “}”, and didn’t get it. Although, this might also be specifically because you were missing an open bracket in the class initializer.
It sounds like you are new to programming, and not just Unity. You should take some courses on coding before you begin working on a video game. At least in my opinion, it is easier to make some simple apps and learn C# than learning to program at the same time that you’re jumping into video game development. I’ve worked on web apps, basic native apps, and video games, and games are the least forgiving to a noobie (unless you are using visual scripting like Playmaker).
If you don’t know what an IDE is, and don’t know how to interpret errors like this yet, it may behoove you to start small and get your feet wet doing something more forgiving first. And that doesn’t mean it will take long. You could spend a month learning, and then be much more equipped to breeze through making your first game.
Sorry. I guess I thought that was the case because you didn’t know what an IDE was and didn’t know how to debug this. My bad. It might still help to take a class on C# because Lua is fairly different. But either way, good luck with your game!
Still im bad but thank you for your help Im just not that good when it comes to programming and this is thankfully to all of you who helped me my first working script ^^
also unity is now a lot more fun before I just dont liked it but now its pretty cool and I will (hopefully) keep geting better and not just me I hope that someday alot of games made by Indie Devs. will be very popular