I couldn’t find any example code for that. well, im only confused about the parameter “previous editor” please help!
Its pretty simple really, all it does is destroy the previous editor instance if it had the same context and same target(s), and then sets it as a new instance.
For this sort of thing you can always take a look at the source code to see what it does. Here is a link.
private Editor _editor;
private MyTargetObject _myTargetObject;
private void CreateEditor()
{
// If `_editor` is already set, it will be destroyed and be assigned a new instance.
Editor.CreateCachedEditor(_myTargetObject, null, ref _editor);
}