How to create an Editor for Imported Objects imported from a ScriptedImporter?
I have created a ScriptedImporter, that imports some json to a ScriptableObject i call JsonAsset. That works fine, i can manually edit the json and see the changes to the fields in the inspector. Now i want to create an editor so i don't have to edit that json manually. I have tried to do that with an Editor and a ScriptedImporterEditor, but every EditorGUILayout field i create is read only. I want to do this:
Load json from file via my ScriptedImporter. Deserialize the json to a JsonAsset. Select this JsonAsset in unity.
(Make some changes in the editor/inspector)
Serialize that JsonAsset to json into the json file. So that the JsonAsset and json match.
It wouldn't be a problem for me if there is a way to bypass the read onlyness of the JsonAsset as i wouldn't edit the unity object representation directly, but the underlying file.
Answer by $$anonymous$$ · May 02, 2020 at 11:23 PM
I have found a really disgusting hacky workaround to do this. I simply force the GUI to be enabled with GUI.enabled = true before i do anything else.
Your answer
Follow this Question
Related Questions
EditorGUILayout.EnumPopup shows always the same selected option but works as programmed 1 Answer
Editor Int sliders affecting each other 0 Answers
How to change the text of EditorGUILayout.TextField 2 Answers
Object field in the scene view - Custom Editor Script 0 Answers
How to Create a Collapsible Hamburger Menu Icon Custom Inspector/Editor 1 Answer