Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by nati8oy · May 08, 2019 at 12:59 AM · profilerperformance optimizationframerate drops

How to know what to focus on for performance enhancement?

Hello all. I have delved into the (infinite) world of performance profiling as my game was having issues with frame rate dropping. I have been looking at the profiler window to try and make sense of it all but need some help to know what I should be focusing my attention on. What would be considered too slow on mobile for a script to execute? I can see the instantiates are adding around 10ms. Am I even looking in the right spot for the information on what could be slowing things down? If anyone could offer any insight or references based on my screenshot that would be great. Quick overview of the game:

  • It's a word game where you pick up tiles and click to play them and make words.

  • All tiles are instantiated from a prefab which contains a button and 2 text fields

  • When tiles are clicked/tapped they are tweened (using iTween) to the board.

  • Issues are only occurring with frame rate when playing on the device (iPad pro 10")

alt text

profiler-hierarchy.jpg (262.5 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlphaGarg8447 · Feb 20, 2020 at 04:07 PM 0
Share

Are you instantiating the object from a prefab, or as a copy of another object in the scene? Pre-loading the object might help alleviate the issue. Don't think I've ever seen an instantiate take that much CPU time, but if you're having issues with it then it might help.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nati8oy · Feb 20, 2020 at 10:43 PM

Thanks for replying @AlphaGarg8447! I am instantiating from a prefab, but I have since pooled the objects and am using those now. That said, I found that parenting objects apparently take a bit of processing power as well. I have also found that there is a way to un-throttle the frame rate even on mobile devices using the below script. This actually solved a lot of my problems (visually) and was very handy so thought I'd share it. This code adde an FPS counter in the bottom right too but the real code you need is just in the Awake function:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class UIFPSDisplay : MonoBehaviour
 {
     float deltaTime = 0.0f;
 
     private void Awake()
     {
         Application.targetFrameRate = 60;
     }
 
     void Update()
     {
         deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
     }
 
     void OnGUI()
     {
         int w = Screen.width, h = Screen.height;
 
         GUIStyle style = new GUIStyle();
 
         Rect rect = new Rect(0f, h-70f, (w - 50.0f), h * 2 / 100);
         style.alignment = TextAnchor.LowerRight;
         style.fontSize = h * 2 / 100;
         style.normal.textColor = new Color(0f, 0f, 0f, 0.3f);
         float msec = deltaTime * 1000.0f;
         float fps = 1.0f / deltaTime;
         //string text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps);
         string text = string.Format("{1:0.} fps", msec, fps);
         GUI.Label(rect, text, style);
     }
 }
 
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

171 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gfx.WaitForPresentOnGfxThread costing over 30ms at RANDOM 0 Answers

Scene Culling WaitForJobGroup Causing CPU Spikes in 2D project 0 Answers

AICharacterControl Spike in Profiler 0 Answers

Mobile Performance Issues 0 Answers

3D Optimization Problem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges