Search Unity

Please... HELP MEEEE!!!!

Discussion in 'Scripting' started by D4V1D_G, Sep 29, 2019.

  1. D4V1D_G

    D4V1D_G

    Joined:
    Sep 29, 2019
    Posts:
    2
    Hello! I am now starting to try to do some programming in C#. Everything was fine, but unfortunately, a programming error occurred. I still don't understand what it is, I hope you can help me :D

    error:

    Assets\scripts\controlecamera.cs(12,65): error CS1002: ; expected

    script:

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

    public class controlecamera : MonoBehaviour {

    public GameObject Jogador;
    private Vector3 offset;

    // Start is called before the first frame update
    void Start() {
    offset = transform.position - Jogador.transform.position
    }

    // Update is called once per frame
    void Update() {
    Vector3 posicao = new Vector3 (Jogador.transform.position.x, 0f, Jogador.transform.position.z);
    transform.position = posicao + offset;
    }
    }


    thanks!
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    Here is a good starting point.
    Using code tags properly
    Also please consider change thread topic, to be more informative.

    Then we can consider in further assist.
     
    Yoreki likes this.
  3. Hikiko66

    Hikiko66

    Joined:
    May 5, 2013
    Posts:
    1,304
    Read the error message "; expected". It's telling you that it expected a semicolon. So, you're missing a semicolon.

    You can double click the error message in the debug log at the bottom of unity, and it should take you to the line of your code that is throwing the error you double clicked. Start using that workflow.

    You should also get into the habit of using a search engine to find out about specific error messages. You will typically find the solution very quickly, unlike posting on a forum.
     
    D4V1D_G likes this.
  4. D4V1D_G

    D4V1D_G

    Joined:
    Sep 29, 2019
    Posts:
    2
    Hikiko66, it worked! That's right, thank you very much and thanks for the tips ;)