2D Toolkit Forum

2D Toolkit => Support => Topic started by: fsadeq on September 20, 2012, 05:53:19 am

Title: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on September 20, 2012, 05:53:19 am
I asked this on the Unity forums, but wanted to check in here too - maybe has something to do with 2dTK.

I just updated to iOS 6 and Xcode 4.5. Everything seems fine and dandy, except now my build runs horrrrribly slow on the iPhone. It was perfectly fine prior to making these updates and I've changed nothing since. I am using Unity 4, testing on an iPhone 4. Anyone else experiencing performance decreases after updating to either/both of these? Thanks.
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on September 20, 2012, 08:15:18 am
This is likely an issue with Unity - I've tested on iOS6, but never bothered trying the XCode 4.5 betas. Have you tested angrybots or some other unity sample?
Were you using armv6 mode?
Have you attached the profiler, or enabled the iOS profiler in the xcode proejct to see whats going on?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on September 20, 2012, 02:14:54 pm
Thanks for the reply. I haven't yet tried any of the demo projects, good idea, will try it when I get back home tonight. I've always been using arm7 only. When I enabled the internal iOS profiler in xcode, it seemed to be struggling on cpu, but mainly gpu time. My FPS used to be near 60, now it is around 30.
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on September 21, 2012, 01:15:07 am
After enabling the internal profiler:

Code: [Select]
cpu-player>    min:  3.6   max: 28.3   avg:  7.2
cpu-ogles-drv> min:  1.1   max: 11.2   avg:  1.9
cpu-present>   min:  5.3   max: 30.1   avg: 17.0
cpu-waits-gpu> min:  1.4   max: 28.2   avg: 14.2
 msaa-resolve> min:  0.0   max:  0.0   avg:  0.0
frametime>     min: 13.2   max: 45.4   avg: 26.1
draw-call #>   min:  16    max:  16    avg:  16     | batched:    10
tris #>        min:  2864  max:  2864  avg:  2864   | batched:   424
verts #>       min:  8080  max:  8080  avg:  8080   | batched:  1180
player-detail> physx:  0.9 animation:  0.0 culling  0.0 skinning:  0.0 batching:  1.0 render: -11.8 fixed-update-count: 0 .. 2
mono-scripts>  update:  2.0   fixedUpdate:  0.0 coroutines:  0.3
mono-memory>   used heap: 1290240 allocated heap: 1417216  max number of collections: 0 collection total duration:  0.0

Not sure what's going on here. I was at an average frametime of 16-17 prior to updating Xcode and my iOS. Didn't change anything with the game code or any assets.  :o

EDIT: I'm also noticing that all my textures look anti-aliased..everything looks very slightly blurry now. Point sampling is on and all of those settings are correct (I haven't changed a thing).
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on September 21, 2012, 08:22:05 am
I'll give this a go when I get a chance, probably sometime this weekend
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on September 22, 2012, 03:39:09 am
I have an update to this problem, easier to just link to my post on the Unity forums: http://forum.unity3d.com/threads/151830-iOS-6-and-Xcode-4.5-performance-problems?p=1042256&viewfull=1#post1042256

So upgrading my device to iOS 6 has nothing to do with it, it is entirely because of Xcode 4.5!
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on September 22, 2012, 09:30:44 am
Interesting. I'll follow that Unity thread to see where it goes.
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 08, 2012, 01:49:27 pm
Any update on this one?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on October 08, 2012, 03:35:04 pm
Yup, heard from Unity this morning, stating that they were able to reproduce using the Xcode project I sent them. They then followed back just now saying that they think it has been fixed in Unity 4 public beta 11 and that it will be released soon. To clarify a few things, they were unable to reproduce when I just sent them the Unity project, but when I sent them my own Xcode project built by my version of Unity 4, they were able to reproduce.

vambier, are you having the same problem? If so, what version fo Unity are you using?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 08, 2012, 08:52:02 pm
It looks like I'm having the same problem. I just started using unity last week so I didn't try it on ios 5.1 but it looks like the animations in my scene are really slow, and there's not that much going on in the scene either. But it runs smooth on my pc and imac. So I want to show the fps to see how it performs, but I'm looking for a way to show the fps in the first place:-)
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 10, 2012, 10:24:36 am
Got an idea how to show the fps in unity?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on October 10, 2012, 01:06:52 pm
http://wiki.unity3d.com/index.php?title=FramesPerSecond
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 10, 2012, 09:15:02 pm
I get a solid 30 fps on my ipad 2
On my windows pc I get +/- 240 fps
On my imac I get +/- 140 fps

I assume my ipad isn't that slow that it can only render 30 fps for my really really simple scene....
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on October 10, 2012, 09:49:22 pm
http://answers.unity3d.com/questions/12281/iphone-can-i-tell-unity-to-run-at-60hz-rather-than.html

Done that yet?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 10, 2012, 10:48:05 pm
Thanks, that was the solution!
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 12, 2012, 07:47:01 am
I just tried to run my scene on an ipad 1 and got 27fps!! And I just started building my scene, so it's not even finished yet.
So I think I cheered to soon... But the whole game is slow, my animations run at 24 fps, so I would think that 27 fps would still be enough for a fluid animation.
But my player moves really slow too, unplayable actually.
Anyone got other ideas about this? Is going back to an older xcode an option? If so, will I still be able to build for ios6?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on October 12, 2012, 09:06:55 am
You need to identify the actual issue first. Profile the game first.

Having said that the iPad1 is massively fillrate bound - this is likely to be the issue. Do you have lots of overlapping sprites?
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 12, 2012, 01:08:09 pm
I do have a couple of overlapping sprites, but I don't think that's the problem.
Before I started using unity a couple of weeks ago I was making a game using the iTorque engine of GarageGames.
They decided to no longer support that engine and it didn't run correctly on the ipad 3, iphone 4 and ios 6 so that's the reason I switched to unity(and I'm really glad that I did!!!) in combination with your 2D toolkit, which is also awesome!!
But the thing is, the game was 2/3 finished, but now I'm rebuilding the game in unity, so the scene I'm testing now I already build once in that engine, and it ran really smooth on the ipad 1, ipad 2, ipod 2nd gen and iphone 4. Since I'm using all the same resources that I used in the other engine I'm certain that the problem is not with the ipad 1. On the ipad 2 I get a higher framerate now, but it's still only 60fps and I think it could do better.
But profiling could be usefull, I will look into that.

fsadeq said it had something to do with upgrading to xcode 4.5 and that it worked fine before that. Any thoughts?
I read the thread of the unity forum that fsadeq posted but couldn't find an answer there.
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: unikronsoftware on October 12, 2012, 01:32:30 pm
Its not going to go any faster than 60fps - its vsynced and thats how fast the display refreshes
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on October 12, 2012, 08:19:12 pm
I do have a couple of overlapping sprites, but I don't think that's the problem.
Before I started using unity a couple of weeks ago I was making a game using the iTorque engine of GarageGames.
They decided to no longer support that engine and it didn't run correctly on the ipad 3, iphone 4 and ios 6 so that's the reason I switched to unity(and I'm really glad that I did!!!) in combination with your 2D toolkit, which is also awesome!!
But the thing is, the game was 2/3 finished, but now I'm rebuilding the game in unity, so the scene I'm testing now I already build once in that engine, and it ran really smooth on the ipad 1, ipad 2, ipod 2nd gen and iphone 4. Since I'm using all the same resources that I used in the other engine I'm certain that the problem is not with the ipad 1. On the ipad 2 I get a higher framerate now, but it's still only 60fps and I think it could do better.
But profiling could be usefull, I will look into that.

fsadeq said it had something to do with upgrading to xcode 4.5 and that it worked fine before that. Any thoughts?
I read the thread of the unity forum that fsadeq posted but couldn't find an answer there.

I'm pretty sure the issue I'm describing is different from what you are experiencing. Mine specifically drops in performance when building from Unity 4 (haven't tried 3.5) and then using Xcode 4.5 to deploy. Performance goes back to normal when deploying with Xcode 4.4. The Unity folks were able to replicate with the Xcode project I sent them and said they think the issue has been fixed in the newest Unity 4 beta (yet to be released, but soon they said).

Have you enabled the internal profiler to see exactly what is taking up so much time? 
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: vambier on October 14, 2012, 07:52:59 pm
Yes I have tried the profiler, nothing strange there...
But I have found the problem, after a lot of digging I thought I'd try different settings for Edit->Project Settings->Time->Fixed_Timestep. I set it to 0.01 instead of the default 0.02. I do an AddForce to my object in the FixedUpdate() function, but I could see it was not the framerate. This fixed it!
But this wasn't the only problem, I also disabled the Anisotropic Textures and Anti aliasing in the QualitySettings, this was wat was causing the lower framerates on the ipad 1 for me...

Thanks for the help!
Title: Re: iOS 6 and Xcode 4.5 performance problems?
Post by: fsadeq on October 15, 2012, 08:13:12 pm
For anyone curious, it appears the latest beta of Unity 4 (b11) resolves these issues I was describing.