Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Need help with Error CS1056

Discussion in 'Getting Started' started by darklordsheev, Jun 3, 2020.

  1. darklordsheev

    darklordsheev

    Joined:
    Jun 2, 2020
    Posts:
    2
    I was following a tutorial for making a GameObject move from player input, and when I did what it told me, it returned error messages.

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

    public class Move : MonoBehaviour
    {
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
    transform.Translate(Input.GetAxis(“Horizontal”),0,0);
    }
    }


    It brought up the error messages;
    Assets/Move.cs(16,35): error CS1056: Unexpected character ' " '
    Assets/Move.cs(16,46): error CS1056: Unexpected character ' " '

    How can I fix this? It happens not only to this, but any time I have to use a string, like with Input.GetKey.
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    This looks like a keyboard language issue to me. Your quote characters (“ ”) are different from the typical utf-8 quote character (" "), so the compiler doesn't actually see these characters as the start/end of a string.

    Try changing your keyboard language to any English language.
     
  3. darklordsheev

    darklordsheev

    Joined:
    Jun 2, 2020
    Posts:
    2
    Thanks so much, Vryken!