- Home /
Frames Per Second Decreases Over Time
Hey guys,
I just started this new game for iOS and I made a SUPER SIMPLE scene where I have two planes and a point light. One of the planes is the player and you can move it via touch. That's the WHOLE game so far and yet the game starts off running at 60 FPS and ends up running at around 4 FPS in a matter of minutes. Even if the game is only booted up and no input is given this problem still happens. Edit: Oh and I have no scripts in the scene and it still happens. Bug???
Anyone else have this problem?
Any ideas?
Thanks
Here ya go @guyt, here's the only script I'm using:
var rotateSpeed : float = 1.0;
var moveSpeed : float = 1.0;
var projectile : Rigidbody;
var projectileSpeed : float = 1.0;
var reloadTime : float = 1.0;
var BulletSpawn : Transform;
private var nextFireTime = 0.0;
function FixedUpdate() {
var playerPlane = new Plane(Vector3.up, transform.position);
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hitdist = 0.0;
if (playerPlane.Raycast (ray, hitdist)) {
var targetPoint = ray.GetPoint(hitdist);
var targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.$$anonymous$$oved || Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Stationary){
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotateSpeed * Time.deltaTime);
transform.Translate((Vector3.forward * Time.deltaTime) * moveSpeed);
}
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began && Time.time > nextFireTime) {
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotateSpeed * Time.deltaTime);
transform.Translate((Vector3.forward * Time.deltaTime) * moveSpeed);
nextFireTime = Time.time + reloadTime;
var bullet : Rigidbody = Instantiate(projectile, BulletSpawn.position, Quaternion.identity);
bullet.rigidbody.AddRelativeForce(transform.forward * projectileSpeed);
}
}
}
@guyt, I have a little perimeter set up around the player made out of box colliders. The bullets are destroyed as soon as they collide with one of them. Forgot to mention that part in the intro. $$anonymous$$y Bad
Answer by FTheCloud · Aug 06, 2011 at 08:34 PM
Fixed :
Downgraded to Unity 3.3 so it was 3.4 that was causing the problem.
Everything runs at 60 frames-per-second now.
Found that 3.4 is extremely unstable with framerate So I'll just stick to 3.3 for now.
Answer by roamcel · Aug 05, 2011 at 09:12 AM
I can think of three main causes for framerate drops:
1- memory leaks (which we can almost certainly exclude)
2- physics (intersecating colliders that can't stabilize - pretty rare)
3- loops
Given the simplicity of your scene, and the absence of scripts in execution, it could be a physics related issue. Maybe just check that your perimeter colliders are not intersecating eachother (since I suppose they're static and manually set-up)
I think it's a bug in 3.4 because it was working fine in 3.3. I looked at your causes and it's none of those because I've even tried deleting everything in the scene except for a guitext with a framerate counter attached to it. The frame rate still ended up dropping to the single digits.
Your answer
Follow this Question
Related Questions
Low frame rate with only one texture on iPad 4 Answers
iPhone - Can i tell Unity to run at 60hz rather than 30hz? 3 Answers
Making a Terrain a child of something dramatically reduces framrate 1 Answer
Is there a way to create applications that run on fixed frame rate of 60fps on iOS? 1 Answer
Is it possible to get above 30 FPS on an iOS device? 5 Answers