I just realized that in the editor during the playmode my game is running at ~30 fps even with empty scene, and if i try to target fps at 200 for example it stay at 30 fps. Even then before in other projects my games was able to reach even 200 fps. What is going wrong in this project? Maybe some default settings?
This is nothing to do with Physics.
I’ll move your post to the Editor forum for you.
You can use the Profiler to see what is taking up what amount of time per frame. It should be your first port of call for any performance questions.
Inspectors in the Unity Editor always refresh at a low update rate. Documentation mentions 10 times per second, so having 30 fps is already an improvement.
You may have a custom inspector refreshing at faster rates by calling EditorUtility.SetDirty from the custom inspector code:
public class MyCustomInspector : Editor
{
public override void OnInspectorGUI ()
{
EditorUtility.SetDirty(target);
}
}
I did. As i said the scene is empty so and
Well actually i did. As i said even in an empty scene the playmode is running at 30 fps and looking the profiler the player loop is constantly running at 30 fps even without scripts. I tried to exclude Unity process from antivirus and didn’t work. So i thought that the problem could come from Nvidia whispermode (that was activated) so i turned it off but that didn’t solve the problem either.
I knew that the inspector run slower than the build but i used to have more fps in playmode. Sometimes even around 200 fps depending on the scene intensity. Btw how should i use SetDirty func to increase fps?
Oh, I see we’re likely talking about different things. It seems I misunderstood the question.
If your game is capped at 30 fps while playing it in the Editor, this may have several causes:
- Project Settings > Quality. Select a different quality here to apply in the Editor. Check out the VSync setting in the selected quality, as this is the typical setting for limiting the fps.
- Build Settings > Target. I’m no expert here, but I’ve read that some target platforms may have a strict FPS limit. Try setting a Desktop target to ensure this part is not a limit.
I already tried all of these options a none of them seems to be working !! Its looks to be capped at 30 fps for some reason. I read on the internet that some people had this problem working with the laptop going with the battery energy and so Unity saves energy making the editor cap at 30 fps but actually my laptop is plugged on energy. On the contrary i don’t even have battery on my laptop because i removed it (could the abscence of battery be the cause of the problem?).
I’d try your project in another computer to ensure the issue is not related to the Unity project itself. It might well be something related with your laptop’s power management.
For example, I’ve also had a similar problem with a laptop, but in this case I couldn’t get more than 10-15 fps when running on the battery no matter the power options I configure. It seems that either the display adapter forcefully enters an aggressive power saving state, or the GPU is just disabled and graphics work on the chipset’s graphics adapter.
Exactly it must be something like that, but it is frustrating to not understand what is going on exactly. Thanks for the tip, i will try from another pc when i will have the chance to do that!
Hey! Wanted to bump this, I found a solution in my case. I was capped a 30FPS in game view, I was at 15 FPS if I had the game view and the scene view open in the editor, viewing both at the same time and playing the game. This was with just a 2D capsule moving around. Really annoying! This was with DirectX11 and 12, Unity 2021.3.29f LTS. I have a wicked computer. Ryzen 64 GB RAM, 3080card. I went to my Nvidia control panel and found I had a max framerate set to 30 for some reason?? I turned it to off, now I am running at over 400 FPS with DX11 or 12. Hope this helps!
Thanks, it worked for me !! It seem like the GameView and SceneView is shared this “max frame”, if I set the max frame to 60, and open both window they will both run at 30FPS. If I keep only one of them open, it will run at the maxFrame (here’s is 60)
Not entirely related, but if you’re having jerky/slow playmode performance, disable g-sync
I found that having an object opened in the inspector (having it selected in the Hierarchy) really slows down performance.
This is a longshot but try not having anything selected by just pressing on an empty space in the Hierarchy.
thanks, this worked for me. is this a feature or a bug?
Poor performance when having an object selected is not a feature!
It might not be a bug, though. You can write arbitrarilly complex inspector code for your components, so it’s totally possible to put Thread.Sleep(5000ms)
in OnInspectorGUI and have your inspector take 5 seconds to render.
If it’s slow due to a built-in component that has a slow inspector, then you should report a bug!