Help, my code bugged out and wont work

Unity error idk what i did


1 Like

You are missing the } at the end of the file. You are also missing the ; at the end of the translate

PS: Welcome to the community!

1 Like

where?

thanks

image

Here. This should be

    void Update()
    {
        transform.Translate(x,y,z); // <- missing ;
    } // <- missing }
}
1 Like

that worked but another one came up

This is what the code in your screenshot should look like:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mover : MonoBehaviour
{
    float x = 0;
    float y = 0f;
    float z = 0;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(x, y, z);
    }
}
1 Like

thank you

Welcome to GameDev Community!

It would also be a good idea to put an ‘f’ behind the zeroes for your float variables X and Z.

‘0’ still counts as a number and the presence of an ‘f’ is still important to C# even if you are not using a decimal.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms