- Home /
Active Inspector Object
I am currently writing some CustomEditor's and ScriptableObject's to improve the workflow on my current project. To gain fast access to one instance of a ScriptableObject, I have created a MenuItem, that selects the asset, by using Selection.activeObject.
While this does show the properties in the Inspector, it also selects the asset in the project view itself, which I want to avoid.
Is there any way, that I can "select" an asset to be shown in just the Inspector? Specifically, I am looking for something like
Inspector.activeObject = myObj;
Edit: My current workaround is a seperate custom EditorWindow script, which let's me display the asset properties without having to select it.
While this does work, it would still be nice, to get the approach with the Inspector working, so I don't have to create custom EditorWindows for each ScriptableObject I am creating.
Hello @$$anonymous$$eatology,
I'm facing the same exact problem. But unlike you, i don't know how to begin with the work around you're mentioning. So if it's no problem to you, could you perhaps post your workaround code here, or on github. But only if you're okay with it. Or if you'd rather just briefly write out the steps, that would be appreciated too. Sorry to bother you.
Thank for reading.
Regards
Godfrey
Answer by crohr · May 28, 2015 at 07:12 AM
Unfortunately, there is no way to avoid the object being selected in the project, as Selection.activeObject is used to determine what to draw in the inspector. What is the reason you want to avoid this behavior, and maybe there is something different that could help you?
The main reason is, so that I can inspect/preview assets in one folder, that I may want to assign to the ScriptableObject, and then inspecting the ScriptableObject, without having to browse to the assets again.
But if there is no way to do that, I will just stick to custom EditorWindows, which works quite well.
If you right-click the inspector tab you can lock the tab and open a second inspector tab to navigate to other objects.
Your answer
Follow this Question
Related Questions
Import Unity package / Asset by script with selection 0 Answers
[Solved]Why doesn't my ScriptableObject based asset save using a custom inspector ? 1 Answer
Why doesn't my ScriptableObject save using a custom EditorWindow? 3 Answers
ScriptableObject with references memory usage (help) 1 Answer
Access a ScriptableObject with missing Script via Code 0 Answers