Performance spikes even with almost empty scene

I’m getting tired of absence of smoothness when application is playing. I’ve tried yet another test to check if it just me doing lame scripts.

Create new project, add one directional light and one cube in it. Scale cube 4 times big. Then create a script (one of ‘JavaScript’, because what if C# is the issue?) and write there:

#pragma strict

function Update () {
	this.transform.Rotate(0, 0, 90 * Time.deltaTime);

Put it on the cube. This is it, now you could:

  1. Run it in editor
  2. Build an android apk and run it on a device (I’m using Tegra3-equipped one)
  3. Build a standalone app and run it separately.

Tracking cube rotation with your eyes you will (or will not) see periodic twitching. It is not too (but still) noticeable on my i5 CPU, but very noticeable on Android. Such a simple scene, what could be wrong and make it not to run smoothly?

And in real application, when there is actually some work to doo, it became even more annoying. Small twitches but ruins all smoothness.

How could I handle it?

Instead of scaling cube to 4 time big, have you tried using a model created of that size itself? Scaling object is sometime overkill, specially if those aren’t static.

Btw, I don’t think there is any issue with C# or Javascript.

Creating a cube from editor adds a box collider without a rigidbody. As far as I can see, you are trying to move it by modifying GameObject.transform, and you also scale the cube.

Physics on Android will randomly hiccup in any of these cases, and you have three of them at once.

On the Android build, try moving your finger around the screen somewhere. My test app runs perfectly if the phone thinks the player is interacting. Let go and the stutter comes back. My example scene is drawing just 10 sprites.