Author Topic: Performance drop on first time a UIButton is clicked in a scene  (Read 8466 times)

alexh0101

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 30
    • View Profile
When my scene start and I press a UIButton for the first time, I get a 178ms lag.

In the Profiler, I see this:



But when I collapse the "UIButton.onClick", nothing appears with that 178ms.

Why is that happening?
If this is mandatory, is there a way to initialise whatever has to be initialised, while the scene is loading?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Performance drop on first time a UIButton is clicked in a scene
« Reply #1 on: April 16, 2015, 05:28:02 AM »
Try a deep profile to further narrow down the culprit. All UIButton.OnClick does is calls whatever delegate you've set.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Performance drop on first time a UIButton is clicked in a scene
« Reply #2 on: April 19, 2015, 08:31:12 AM »
Yeah, follow it deeper down. It's likely whatever you have set the game to do when you click. Say if you have a button "load new scene" then the stack trace will start at the UICamera, then to the button and further down until you get to the real culprit (loading a scene).