- Home /
Question by
LudvigDK · May 21 at 09:52 AM ·
custom-inspector
ScriptableObject in custom GUI
I want to make a crafting system for unity and want a recipe scriptable object where you can drag and drop item scriptable objects in to make a recipe. my problem is just that i dont know how to seralize a scriptable object in a custom gui. pls help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Recipe))]
public class RecipeEditor : Editor
{
public override void OnInspectorGUI()
{
Recipe recipe = (Recipe)target;
EditorGUILayout.BeginHorizontal();
recipe.slot1 = EditorGUILayout.ObjectField(Item, typeof(ScriptableObject), true);
EditorGUILayout.EndHorizontal();
}
}
Comment
Your answer

Follow this Question
Related Questions
what does @CustomEditor do ? 1 Answer
Custom Editor Search bar 2 Answers
Custom inspector variable resets automatically 1 Answer
Custom Inspector, Collections, SetDirty 0 Answers