Question by
MamaKino · Mar 19, 2017 at 06:18 PM ·
scripting problemeditor
Getting an array of objects to show in editor
Hello there, I've been trying for a while to get some items to show up in the editor. I am using a scriptable object to hold a preset amount of ItemObjects
However the editor isn't showing me them despite being public.
Here is the ItemObject
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemObject {
public Items SOitems;
public string itemname;
public GameObject model;
public double price;
public ItemObject()
{
itemname = "";
price = 0;
}
public ItemObject(string name, double price)
{
this.price = price;
itemname = name;
}
}
The Scriptable object is here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Item Models", menuName = "Inventory/List", order = 1)]
public class Items : ScriptableObject {
public ItemObject[] itemlist = new ItemObject[2];
void GetModel(string item)
{
}
}
I have already created the object. Not sure what else i can do
Comment
Best Answer
Answer by MamaKino · Mar 19, 2017 at 06:23 PM
In case anyone has this problem, You have to add [System.Serializable] just after all the imports and before the class like this:
[System.Serializable]
public class ItemObject {
public Items SOitems;
public string itemname;
public GameObject model;
public double price;