How do i fix the "," error aka error CS1003

here’s the code

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Security.Cryptography;
using UnityEngine;

public class PickUpScript : MonoBehaviour
{
    public float distance = 10f;
    public Transform EquipPosition;
    GameObject currentWeapon;

    bool canGrab;


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

    // Update is called once per frame
    void Update()
    {
        CheckGrab();
        if (canGrab)
        {
            if(Input.GetKeyDown(KeyCode.E))
            PickUp();
        }
    }

    private void CheckGrab()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, distance))
        {
            if (hit.transform.tag == "CanGrab")
            {
                Debug.log("i can grab it");
                currentWeapon = hit.transform.gameObject;
                canGrab = true;
            }
        }
        else
            canGrab = false;
    }

    private void PickUp()
    {
        currentWeapon.transform.position = equalPosition.position;
        currentWeapon.transform.parent = EquipPosition;
        currentWeapon.transform.localfulerAngles = new Vector3(0f 180f 180f);
        currentWeapon.GetComponent<RigiBody>().isKinematic = true;

        Debug.Log("Picked It Up");
    }
}

It would be really helpful if you include the full error message please. Especially the part at the end with the number (that tells you which line of code has the error).

Assets\PickUpScript.cs(54,72): error CS1003: Syntax error, ‘,’ expected

Assets\PickUpScript.cs(54,67): error CS1003: Syntax error, ‘,’ expected

You did not put commas between the parameters of Vector3. So it should be Vector3(0f, 180f, 180f).

1 Like

Assets\PickUpScript.cs(41,17): error CS0104: ‘Debug’ is an ambiguous reference between ‘UnityEngine.Debug’ and ‘System.Diagnostics.Debug’

Assets\PickUpScript.cs(52,44): error CS0103: The name ‘equalPosition’ does not exist in the current context

Assets\PickUpScript.cs(54,33): error CS1061: ‘Transform’ does not contain a definition for ‘localfulerAngles’ and no accessible extension method ‘localfulerAngles’ accepting a first argument of type ‘Transform’ could be found (are you missing a using directive or an assembly reference?)

Assets\PickUpScript.cs(55,36): error CS0246: The type or namespace name ‘RigiBody’ could not be found (are you missing a using directive or an assembly reference?)

Assets\PickUpScript.cs(57,9): error CS0104: ‘Debug’ is an ambiguous reference between ‘UnityEngine.Debug’ and ‘System.Diagnostics.Debug’

all these just popped up

Delete this line to fix the ambiguous reference errors: using System.Diagnostics;

The rest of your problems are just misspellings. Check your spelling and capitalization on those lines.

what do i capitalize??, sorry im new to unity and coding

For example: “Assets\PickUpScript.cs(55,36): error CS0246: The type or namespace name ‘RigiBody’ could not be found (are you missing a using directive or an assembly reference?)”

There is no such thing called “RigiBody” in Unity. There is a “Rigidbody” however. Just go through each error and make sure you’ve spelled things correctly. if you’re not sure about one, google it and you’ll find the correct spelling.

Correct names, and capitalization are important in programming. Most of your errors, as @PraetorBlue mentioned, are just typos. The error is actually pretty explicit about that. “Transform does not contain a definition for localfulerAngles”. Why? Because localfulerAngles does not exist, thus is cannot find it. Instead you meant localeulerAngles, which does exist. RigiBody does not exist, but Rigidbody does. And so on.

thx, most of the errors are fixed but the Rigidbody and localeulerAngles still cant be found

Unity - Scripting API: Transform.localEulerAngles Again, check Capitals

Your IDE should be prompting you with correct spelling. if it isn’t, check you’ve setup correctly

2 Likes