• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Waliactico · Feb 05, 2019 at 04:11 PM · editorinspectorcustom editorcustom-inspector

Custom editor super slow even with no draw operations

I have a big class (object has large arrays serialized), and default inspector is totally unusable, super slow and unresponsive. I've done a custom inspector to work on this object with responsiveness, and it worked fine. But now, object has even larger arrays, and custom inspector is getting also super slow. I've tried with just this OnInspectorGUI:

 public override void OnInspectorGUI()
 {
     GUILayout.Space(1000);
     GUILayout.Label("______________");
 }

and it's still suuuper slow on scrolling. Deep profile says the culprit is

 serializedobject.Update()

, which is executing in background while the object is selected, even when it's not necessary. So, is there any way to optimize this custom inspector by saying it not to update unless necessary? I don't want serializedobject.Update() to be executing twice per frame and wasting more than half second if I won't be modifying the object.

Thanks for your time!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Feb 05, 2019 at 04:30 PM

You just shouldn't put too much serialized data into a single object. That kind of data do we talk about? If it's static / configuration data it probably should be stored in a seperate ScriptableObject. Maybe you can break down the data into smaller chunks.


Your question is lacking this important detail and without knowing how much data and what kind of data you have stored in your object we can't suggest any alternatives.


At runtime if you select an object, Unity has to update the inspector every frame. The inspector always works on the serialized data. So the object need to be serialized once per frame. If you put too much serialized information into a single object, of course it slows down the update of the inspector.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Waliactico · Feb 05, 2019 at 04:37 PM 0
Share

it's data to access and show in runtime, right now it's totally localized in that object. I wouldn't want to split it in different objects for code simplicity, so I'm assuming this is inevitable then?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

136 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can i get SerializedProperty from UnityEvent which in List. Sorry for my Eng. 2 Answers

Questions Regarding Images in Custom Inspector/Editor 1 Answer

Unity Editor - Class variable value contrain 4 Answers

Null reference exceptions when using a Custom Editor 0 Answers

Make a custom inspector that shows a group of variables in form of list 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges