You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at allUnityEngine.MonoBehaviour:.ctor()
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Item : MonoBehaviour
{
public string itemismi,itembilgi;
public int itemid, itemmiktar, itemdepomiktar, itemhasar;
public Sprite itemicon;
public GameObject itemmodel;
public ItemType itemtipi;
public enum ItemType
{
Silah,
Malzeme,
Yiyecek,
Bos
}
public Item (string isim, string bilgi, int id, int miktar, int depo, int hasar, ItemType tip)
{
itemismi = isim;
itembilgi = bilgi;
itemid = id;
itemmiktar = miktar;
itemdepomiktar = depo;
itemhasar = hasar;
itemtipi = tip;
itemicon = Resources.Load (id.ToString());
itemmodel = Resources.Load ("Kup");
}
}
↧