Reputation: 31
My game I'm trying to upload to Apple is getting rejecting for crashing upon startup and I took it back into Unity for debugging. I discovered that the first frame of my profiler is reaching over 900ms on the other section! I don't know the steps to take to find out what scripts are getting over 900ms or how to fix this absurd value, I attempted to add a lagHandler script that loaded gameObject asynchronously, this is a picture of the profiler and the script I tried to make. The script did help a little by making the rest of the gameObjects load slightly later and more distributed but the first frame is still HUGE and I don't know how to fix the 900ms.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class lagHandler : MonoBehaviour
{
public List<GameObject> objectsToActivate;
public float initialDelay = .5f; // Initial delay in seconds
void Start()
{
StartCoroutine(ActivateObjects());
}
IEnumerator ActivateObjects()
{
yield return new WaitForSeconds(initialDelay); // Wait before starting activation
foreach (GameObject obj in objectsToActivate)
{
obj.SetActive(true); // Activate the object
yield return null; // Wait one frame before activating the next object
}
}
}
Not sure what to fix now since I already took the verts down to about 50K and even without canvas animations it is slow.
Edit I was testing out the profiler more and I disabled every single gameObject including the lagHandler and the profiler is still reaching over 900ms, this goes deeper and perhaps into the player settings, but I can't find out what it is at all.
Upvotes: 0
Views: 31