Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Code help pls

Discussion in 'UGUI & TextMesh Pro' started by carlkbh, Sep 20, 2021.

  1. carlkbh

    carlkbh

    Joined:
    Jun 21, 2021
    Posts:
    3
    hi, im having some problems with my code

    using UnityEngine.UI;
    using UnityEngine;

    public class Score : MonoBehaviour
    {
    public Text ScoreText;
    move.Points


    // Update is called once per frame
    void Update()
    {
    ScoreText.text = Points;
    }
    }

    i am getting this error:
    Assets\Score.cs(11,5): error CS1519: Invalid token 'void' in class, struct, or interface member declaration

    i just started coding, and im stuck on this problem
     
  2. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    230
    The line
    move.Points
    has bad syntax in C#. If you remove it it should compile and declare a variable for `Points`, it should compile. Or I assume you want to have access to a Move class somewhere, so you would need to declare it as a variable.

    Also, `UnityEngine.UI.Text` is not in the UI Toolkit but in ugui. You should try this forum if you have more questions: https://forum.unity.com/forums/ugui-textmesh-pro.60/
     
  3. carlkbh

    carlkbh

    Joined:
    Jun 21, 2021
    Posts:
    3
    super cool, thanks for your swift reply! thanks for the link, ill check it out