Are scriptable object causing Unity Editor to lag? - unity3d

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.

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

Related

Floppy Disk icon Middle of my screen when game is running

I'm a beginner in unity and programming, I was following a video for making a Flappy Bird game. Everything works perfectly but when I run the game, I get a floppy disk icon middle of the screen and somehing called DontDestroyOnLoad starts working out of nowhere. I couldn't find or understand anything on google when I search for it. I'm posting the screenshots in case anybody wanna see it.
This icon and dontdestroyonload thing only appears when game is being run:
There's a little button in the type right of your scene and game view called "Gizmos", un-toggle that button, should fix your issue.
Also don't worry, Gizmos can only be seen in the Unity Editor for level editing and debugging purposes --> if you were to build the game, for instance on IOS, they would disappear.
(if this doesn't fix your issue, then I would just create a new scene and copy your gameobjects over one-by-one)
I see someone responded about the main part of a problem, but I'll clarify about dontdestroyonload
Don't destroy on load is collection of objects that won't be destroyed when new scene will be loaded, usually objects there come from running them through DontDestroyOnLoad method somewhere in a script, however I noticed that some time ago Unity creators started to put there some stuff related to built-in tools (like debug)

Text Mesh Pro UGUI Objects disappearing in Play Mode, Unity Version 2019.3.5fl Personal

So I have been stuck in this issue for awhile now: I get the error message: "Reference Exception: Object reference not set to an instance of an object" but that's because some of my text mesh pro objects gets deleted by itself!!! Apparently every single time I hit play some of the text mesh pro objects disappear from where it was assigned in the first place..
Code Implementation in the script class:
Example: This is how it look before play mode:
Now this is how thei nspector section looks like while on play mode:
Now once I hit play a few text mesh pro objects just got deleted by itself..
Any idea or feedback please?
Thank you in advance!
Amaury
Alright I see what is Wrong.
In the inspector, you set every Text Mesh Pro Object you need.
But in your script, you are using the function GetComponent on every of the object, which is useless and even buggy since you already declarate them in the inspector.
Remove these lines and it should work :)
EDIT: Also, for your interest, the function GetComponent will only return the first component found ATTACHED to the gameObject. But you don't have TMPText attached to your gameObject and more than that, you don't have MULTIPLE TMPText attached.

How can i save and load Anchorpoints using Unity

Every time I make the Select gesture, a new instance of the Cube prefab is created and placed in the Room. I would like to save the position of all the instances for example every 10 seconds. Furthermore I would like to load the saved instances when the app restarts.
I created a C# skript attached to the MainCamera with the following Content that i found on the Unity manual site https://docs.unity3d.com/Manual/windowsholographic-persistence.html. I do not know if that is more or less the right way or if its completly the wrong idea. the content of the LoadSave skript
I am completly new to unity and mixedreality and would be very thankfull if someone could help me.

Share same Navmesh with Duplicated Scenes

I had a Scene with a map (some buildings and roads) and Baked Navmesh, then I started Duplicating the Same Scene with modifying some objects inside (not the map or the world), so all the Scenes were sharing the same Navmesh somehow, then I deleted the Navmesh accidentally, Now the only way I seem to find is to create a new baked Navmesh for every Scene which will increase the build size too much!, How can I re-share the same baked Navmesh with all Scenes since all have the same map inside ? I am using Latest Unity3D.
Before You Start: if you have a lot of assets in your project changing serialization to Force Text may take a lot of time. So you may want to copy the target scenes to a new project, do the below mentioned steps and paste them back. :)
There is no way to do this from Unity editor, but there is a workaround:
Go to Edit > Project Settings > Editor and change the Asset Serialization to Force Text (default is Mixed) - this makes sure all assets, including your unity scene files are saved as text documents
Now open your scene file (the one with baked NavMesh) in any text editor
CMD+F or CTRL+F to focus on search bar and type "NavMeshSettings". In NavMeshSettings the last entree should be m_NavMeshData:{fileID:1234 //and some more stuff here} - this is reference to your baked NavMesh asset file. Copy the whole line
Now open the second scene that you want to share your NavMesh to (open in text editor again). Find exactly the same line starting with m_NavMeshData, delete it and past the line from the previous scene.
BOOM!
Edit/Tip: You may want to change serialization to Mixed again if you want to. The only downside of texted serialization is bigger files. It is mostly used for version controlling and merging and the scenes and stuff...

Unity - Stop When Building

I have finished my game in Unity already.
But whenever I'm trying to build the game, it stops at the point as shown below. Does anyone know the reason why it happens? It always stops at the same point....
It's a problem with baking the lightmaps on your scene.
Unity doesn't like huge objects when it comes to baking lightmaps on them and it can certainly kill the light transport on a build.
You can try to open the Window menu from the main Unity menubar and search for the "Continues baking" checkbox under Lightning and uncheck it.
Or you can just split your bigger objects on your scene which may cause this problem.
Here's a thread detailing the issue a bit.
I've also seen people working around this problem by disabling Global Illumination altogether so that may be a solution for you as well if you are using it and you are willing to give up on that feature.
Edit: Another thread about this sort of thing with a decent solution - not sure why I didn't remember it for first but it's a good idea before trying to split your huge objects to mess with their "Scale In Lightmap" property as well to reduce the lightmaps' size.
You can also try the "Advanced Parameter" options.