Answer the question
In order to leave comments, you need to log in
How to use the class in the editor?
I have a prefab to which a class is attached, let's say Test, in order to edit it in real time, I added it to the editor
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(Test))]
public class TestEditor : Editor{
public override void OnInspectorGUI(){
base.DrawDefaultInspector();
Test re = (Test)target;
re.TestMethod();
..................................
}
}
using UnityEngine;
public class Test: MonoBehaviour{
public void TestMethod(){
if(VarA < DataStorage.instance.SomeVar){ .....
Answer the question
In order to leave comments, you need to log in
Zefirot , error is nullref. The object does not exist in the editor because DataStorage.instance is filled in Awake (which, in turn, will not work as you want in edit mode).
You need to write custom scripts for the editor, which will get data for the UI in a different way (load data from a file along the path , for example)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question