Question by
VinDev-InDev · Jun 04, 2020 at 03:38 PM ·
scripting problemerrorinventory systemsyntax-errorcs1003
Missing ',' when there is no need?
I am trying to make an inventory system, but unity gives me 3 CS1003 errors, (expected ,) but I dont see any syntax error, Usually you would need a ',' if you were assigning multiple variables at once, but I ended all of them with a semicolon, whats happening? Can anyone tell me the problem?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InventoryHandle : MonoBehaviour
{
public Image slot1;
public Image slot2;
public Image slot3;
public Image selected;
public float selectedslot = 1f;
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.1)) {
selectedslot = 1;
Debug.Log(selectedslot);
}
if (Input.GetKeyDown(KeyCode.2)) {
selectedslot = 2;
Debug.Log(selectedslot);
}
if (Input.GetKeyDown(KeyCode.3)) {
selectedslot = 3;
Debug.Log(selectedslot);
}
}
}
Comment