Game runs rough initially then clears up

I have a problem where for about 10-20 seconds after my game becomes active to the player, performance is poor with very pronounced stuttering. Immediately after that, it runs perfectly smooth which was causing me to suspect there were resources still being loaded despite the game being “playable”.

I tried hooking into the sceneLoaded event as implemented below, but it is indicating that the scene is loaded well before the performance issues have cleared up.

Are there any other reasons that may account for the delay in acceptable performance I am seeing?

Thanks.

        void OnEnable()
        {
            SceneManager.sceneLoaded += OnSceneLoaded;
        }

        void OnDisable()
        {
            SceneManager.sceneLoaded -= OnSceneLoaded;
        }

        private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        {
            Debug.Log("Scene fully loaded");

            // Do post-load stuff        
        }

You’d need to profile it to see what your application is doing as there’s an actually endless amount of reasons why that might happen.

Thanks. While I understand performance issues in general can have innumerable causes, I thought perhaps my particular situation might be related to a known situation. I will certainly profile, but as slow and laborious as that can be at times, I wanted to at least first check to see if my specific use-case corresponded to any well-known causes of which I was not aware.

What hardware is it even? There’s no info here that can possibly narrow this down.

If it is a mobile, it could be memory. What are you doing on startup in your application? A long period of stuttering is memory related sometimes but other times it is what your game is doing. Or it’s the specific GPU. And so on, honestly need more information.