0

So to make it simple, I am working with ScriptableObject in my project, all of a sudden i tried to add one more and the editor became so laggy that I can't keep working on the project it's way too annoying to handle...

I have creating a lot of ScriptableObject in my Unity project by hand. My program is quite simple, I just load my ScriptableObject from my Assets folder then do things with them.

I have mainly 3 types of ScriptableObject :

  • Extract (contains string, texture & audio)
  • Theme (contains a enum value & a list of Extract)
  • Oeuvre (contains a string & a list of Theme)

The data linked on the ScriptableObject are in another folder in Assets.

I tried to upgrade from Unity 2019.4.14f1 to 2020.3.4f1 and... nothing changed, too much lag to do anything correctly, it's like several seconds each time I click on a folder BUT the editor started to display a message while freezing (instead of not showing anything at all and just not responding) its says ProjectBrowser.OnGUI.repaint with a progress bar.

At this point I started to observe that the lags occured only while I was browsing some ScriptableObject in my project, when I want to edit some c# script or gameObject within the Scene the message never show up and the editor is smooth like before.

At this point I have around 200 ScriptableObject right now when the editor started to lag.

Maybe I am doing something wrong ? Is the problem coming from the ScriptableObject to reference each other ? Would be great if anyone could give me an hint :)

I am working with a project2D, if it can help...

Thanks in advance.

1 Answers1

0

You can use Profiler to detect what causing problems and which object consumes how much time to render or calculate. You can find if ScriptableObject causing problems or not. You can look:

https://docs.unity3d.com/Manual/Profiler.html

HTugsadK
  • 81
  • 5
  • Thanks for the link, I didn't know where to find this kind of tool. Maybe I don't know how to handle it correctly but as the editor completely freeze while the progress bar is showing I can't really see what is happening. The OnGUI.repaint is taking all the main thread ressources every time the mouse is moving when browsing a folder containing ScriptableObjects... And it's getting worst I had a whole full 5 minutes freezing with profiler open, without being able to do a thing. – Tanguy HELLER Apr 20 '21 at 10:20
  • Profiler comes with Unity as default after 2019 I assume. If the profiler also is freezing, you can use the profiler in standalone mode, with that profiler will work independently from your games and you can check resources. You can even see which functions are causing trouble inside objects, scripts, shaders ... I hope you can find a problem with this way. If this not solve your problem ı suggest that check for the loops in your code. Maybe you miss something that consumes too much time. – HTugsadK Apr 20 '21 at 10:58
  • The profiler is going throught freeze in stand alone mod as well... I tried to create a new project from scratch in Unity 3D, moved all the assets by batch and for some reason I don't have any lag or anything... Still interesting if someone have some clues about the problem encountered. – Tanguy HELLER Apr 20 '21 at 12:24
  • I’ve had this before with a custom editor. Did any of your scriptable objects have custom editors on them? – Adam B Nov 04 '21 at 02:34