M
M
Mind20772021-04-12 14:48:36
C++ / C#
Mind2077, 2021-04-12 14:48:36

How to solve the problem where the code gives 24.33 CS1026: ) 24.63 CS1002:; 24.63 1513: } 30.3 CS1022:?

The code:

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

public class Pickup : MonoBehaviour
{
  private Inventory inventory;
  public GameObject slotButton;

  private void Start()
  {
    inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();

  }
  private void OnTriggerEnter2D(Collider2D other)
  {
    if (other.CompareTag("Player"))
    {
      for (int i = 0; i < inventory.slots.Length; i++)
      {
        if (inventory.isFull[i] != true)
        {
          inventory.isFull = true;
          Instantiate(slotButton; inventory.slots[i].transform);
          Destroy(gameObject);
          break;
        }
      }
    }
  }
}

Errors:
-24.33 CS1026: )
-24.63 CS1002
-24.63 1513
30.3 CS1022
Unity latest version

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-04-12
@Mind2077

Instantiate(slotButton; inventory.slots[i].transform);
Semicolon as separator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question