not sure what to say here so ima put the script and the warning and hopefully someone can tell me how to fix it
ItemClass Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemClass{
//Icons
public static Texture2D pistolIcon;
//Items
public ItemCreatorClass pistol = new ItemCreatorClass(0,"Pistol", pistolIcon,"Nice little pistol");
public class ItemCreatorClass{
public int itemId;
public string itemName;
public Texture2D itemIcon;
public string itemDescription;
public ItemCreatorClass(int id,string name,Texture2D icon,string description){
itemId = id;
itemName = name;
itemIcon = icon;
itemDescription = description;
}
}
}
Warning Message in console
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 all
UnityEngine.MonoBehaviour:.ctor()
ItemClass:.ctor()
and here is how i am calling it in the other script
calling from another script
ItemClass itemClass = new ItemClass();