using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Playercontrol : MonoBehaviour
{
public float moveSpeed;
float xInput,yInput;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
xInput = Input.GetAxis("Horizontal");
yInput = Input.GetAxis("Vertical");
trasnform.Translate(xInput * moveSpeed, yInput * moveSpeed, 0)
}
}
Hey!
You can usually type those in google to see what they mean Compiler Error CS1002 - C# | Microsoft Learn
Basically you are missing a “;” here at the end:
trasnform.Translate(xInput * moveSpeed, yInput * moveSpeed, 0)
If you’re going to ask for help, provide the full error message not a paraphrasing of the issue. The error would tell you exactly the line number where your problem is.
But based on what you have provided, your problem is two-fold.
trasnform.Translate(xInput * moveSpeed, yInput * moveSpeed, 0)
You are missing a ; at the end of the line. And you have misspelled transform on the same line.
If you are going to write code, then you have to be exact with spelling, captilisation, and and punctuation on every line. One mistake and it will all fail.
thx
thx
For future reference, remember: NOBODY memorizes error codes. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.
The complete error message contains everything you need to know to fix the error yourself.
Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors.
The important parts of the error message are:
- the description of the error itself (google this; you are NEVER the first one!)
- the file it occurred in (critical!)
- the line number and character position (the two numbers in parentheses)
- also possibly useful is the stack trace (all the lines of text in the lower console window)
All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.