Search Unity

Bug ERROR CS8124 AND CS1519 FOR UNITY 3D

Discussion in 'Scripting' started by Saisarvesh, Dec 3, 2021.

  1. Saisarvesh

    Saisarvesh

    Joined:
    Dec 3, 2021
    Posts:
    1
    I'm getting error CS8124: Tuple must contain at least two elements and
    error CS1519: Invalid token '(' in class, struct, or interface member declaration
    please help
    im new to coding
    this is my code :
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class PlayerScript : MonoBehaviour
    4. {
    5.     CharacterController characterController;
    6.     public float speed = .1f;
    7.  
    8.     public Rigidbody rb;
    9.  
    10.     public LayerMask groundLayers;
    11.  
    12.     public float jumpForce = 7;
    13.  
    14.     public BoxCollider col;
    15.  
    16.     // Update is called once per frame
    17.     void Update()
    18.     {
    19.         float xDirection = Input.GetAxis("Horizontal");
    20.         float zDirection = Input.GetAxis("Vertical");
    21.  
    22.  
    23.  
    24.  
    25.         Vector3 moveDirection = new Vector3(xDirection, 0.0f, zDirection);
    26.         transform.position += moveDirection * speed;
    27.  
    28.         if (Input.GetKeyDown(KeyCode.Space))
    29.         {
    30.             rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
    31.         }
    32.  
    33.     }
    34.  
    35.     FindObjectOfType<GameManager>()EndGame();
    36. }
    37.  
    38.  
    39.  
    40.  
    41.  
    42.  
     
    Last edited: Dec 3, 2021
  2. You can't have half-baked code in your class definition (nowhere really).
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    This is the documentation forum! You're posting here because of your typos. You should post in the scripting forum so I'll move it.

    It really looks like you should use the Unity Learn site and/or follow some of the C# starter tutorials that Unity has to offer such as here.
     
    Terra_Blade likes this.