Why is instantiating a lot of prefabs made with ProBuilder so slow? - unity3d

I'm making an FPS game in unity. So far I'm working on a procedurally generated map/arena. This means a lot of instantiated prefabs at the start of the game.
Each prefab is a prototype of a building with (on average 5-10) gameobjects made in Probuilder - mostly just planes.
However, I have run into a problem - the instantiations are very slow. I tried to run the game in a profiler and it seems like the gameobjects made with probuilder run some kind of their logic on awake. And this logic takes up too much time.
What is the culprit in the slow instantiations? What precautions should i take to make it faster?
I'm using unity 2020.3.43f1 and probuilder 4.5.2, if that matters (I picked up this project again after not working on it for about an year and didn't care about updating packages).
Here is a screenshot from profiler:

Related

URP Shader Graph shaders time node doesn't work in certain situations

I have several shaders that use the Time node to animate certain UI elements for my mobile game.
In certain cases (which I am unable to reproduce), the shaders will be stuck on a specific time and not animate.
For example, a shine shader might be stuck mid-shine.
Some important things to note:
Time.timeScale is 1 - all my tweens using scaled delta time are working correctly
When this happens all shaders using the time node in the active scene will "freeze in time"
This only reproduces on actual Android devices (iOS untested)
All parameters affecting time in said shaders are positive, valid numbers
There are no errors or warnings
When I transition from my main menu scene to the game scene, time based shaders will work correctly - when I come back to the main scene, it will reproduce again (obviously it's something specifically there)
Running on Unity 2019.4.11f1 with URP & Shader Graph 7.5.1, but it did reproduce in older versions of Unity/URP as well
Sample shader - The preview actually looks exactly like the issue as it will appear in game when frozen:
For any lost souls who stumble upon this issue (although I doubt it's by design as it seems like a bug).
The problem is that time isn't updated in shaders in scenes without a camera.
The camera doesn't have to render anything; it just needs to exist.
My main menu is pure UI elements and had no camera; adding a camera to the scene fixed the issue.
It is important to note that this behavior only happens once you build to an Android device; not sure if it reproduces on other platforms.

Is there a difference to creating your scene in the Game Engine or the 3D creation software?

Hey I have a simple question which I am having trouble finding any info about it online.
Situation: I am making an island explorer game.
In Blender i am creating my islands and all the static objects with the island (Trees, rocks, folliage, buildings, etc.) and exporting this island & static objects together in 1 FBX file. Then in Unity3d I have my scene already done I don't have to perform the scene creation there, i can focus on developing the interactable objects.
When I want to make a new island I just use the same project in Blender and re-use my previous works if I want to. Then export the new island to unity3d.
Is this correct? Am I supposed to "dress" my scene in Unity3d or in Blender? Does it make a difference (performance wise)
What I understand is that when I export multiple islands that are reusing the same tree for example, in Unity3D even though these trees are the same they are in different fbx's. But this only affects project size afaik?
It depends what you are making. Unity has a lot of tools, specifically environment creation tools that are much faster and more powerful to use in Unity rather than import from blender, especially for laying out a scene and prototyping.
Tools to check out:
ProBuilder (Asset Store)
PolyBrush (Asset Store Deprecated) :(
Terrain (Package Manager)
It is good that you are learning blender as for making characters / detailed objects its still the way to go.
Performance is based on verts / textures and won't matter if you make something in Unity or import from Blender.

Unity on Xbox One - Camera/Rigidbody Visual Movement Hiccup

This is posted here since this is Xbox specific, but I am also posting this onto the Unity forums.
When testing my Unity game on Xbox One I am getting a very large amount of visual "jitter" from the ball. This is a skeeball game where you control the movement of the ball. Essentially the core of the movement is similar to the Rollerball tutorials. On PC this works fine and there are no perceptible jitters. However, on Xbox, I am seeing this a lot more. The object is travelling large distances with the camera following smoothly behind. None of the other objects or scenery are affected, I actually think the camera itself is moving perfectly. But, the ball itself seems to glitch.
Changing my camera movement to LateUpdate seemed to minimize it the most on the PC, but that doesn't make sense to me since I am still not convinced the camera is the problem.
Any help would be greatly appreciated. Perhaps a quality setting isn't placing nice with the Xbox?
Thanks!
Nick
Keep in mind the clock speed of the CPU on the Xbox is likely much slower than your PC (although there are more cores).
Unity is primarily single threaded, so that could explain the performance difference. Here are some things you can try:
* Make sure you are running the "Master" build on Xbox. The default is "Debug" which is significantly slower.
* It's possible it's something with the physics.
Once you've checked to make sure you aren't running Debug, the next step would be to use the Unity profiler to see where your frame time is being spent, then depending on what the cause is optimize that part.
Here is more information on the system resources:
https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation
There is also a great post about the graphics debugger here:
https://tarhik.wordpress.com/2017/09/04/antimatter-instance-dev-log-entry-2-using-microsofts-graphic-debugger/
It looks like switching the RigidBody to use "Extrapolate" instead of "Interpolate" fixed the issue I was seeing. I am not sure if this works for every situation, but for the scale of the levels and the player physics of my game this seemed to do the trick.

Scene takes 20secs to load because of StandaloneInputModule

My main scene is taking 20 secs to load and after running the profiler it points to StandaloneInputModule as what makes it take that time.
I've searched in project for that script but it does not exist, i've only found a StandaloneInput
¿Where can i find this script/reduce this load time?
StandaloneInputModule is in the Event System GameObject that you have in your project and it's the responsable of your input in the game that you are developing :)
The problem is essentially that you may have a ton of world space UI Canvases in your game. Each of these canvases has a "graphics raycaster" script, because I think they're put there automatically when you create a canvas (could be wrong). Just remove all of those graphic raycasting checks on all of those canvases. The event system was having to try to keep track of all of those objects, and thus the "Eventsystem.Update()" was having a really hard time. Getting rid of those "graphic raycaster" scripts freed up a ton of CPU time in my game.
The good news is that the "Event System" script and the "Input module" script are not terrible for performance in and of themselves. This is great news for me, because I thought it was on Unity's end, and it turns out not to be (unless you need a lot of graphic raycaster checks).
Peace!

Unity crashes when changing scenes in the editor but not when built

I am currently developing a game for the Vive using Steam VR. After updating to 5.5, Unity is freezing when I try to load into roughly half of my scenes when playing in the editor (I have not made any changes), but when I build and run, Unity does not freeze and everything works as would be expected.
I have gone as far as removing all game objects from a scene and replacing the vive camera rig with a unity camera and clearing all baked data, and even then, when I load into the empty scene the Unity editor will still freeze. This is very strange because I can load into some of my other scenes without them being affected.
One thing that I have noted is that the affected scenes that I can not load into I have heavily been working on in 5.5 and not so much in 5.4, so perhaps there is something there?
All of the scenes use the same prefab for a character controller, and the only scripts in my scenes are attached to that. I am really at a loss here. Any ideas or thoughts about things I can try to resolve this would be much appreciated!
As I stated previously, the game builds and runs completely fine, but the editor in play mode freezes when loading into some of my old scenes, even after removing everything from them and only leaving in a Unity camera object to sum it up.
I also have deleted the library folder and reopened my project with Unity and this did not fix it either.