Quantcast
Channel: Questions in topic: "framerate drops"
Viewing all 141 articles
Browse latest View live

(Unfixable?) iOS frame drops/stutter issues

$
0
0
I have a REALLY basic game and I have done my best to optimise the hell out of it but I still get an odd pause that lasts around 0.2 of a second every so often. I have noticed that the longer I leave the game running, the less is occurs. I have cached EVERYTHING in my game, I have tried running without collision, I have turned off all the sound, removed game objects, I have literally tested with and without every single item in the game and I can't get it to go ways. The other issue is that the collision is very delayed. When my ray cast hits the object, there is a decent pause before it triggers the "game over" function. This is a basic game with 5 obstacles that I recycle, a player ship that is made out of six separate parts that breaks up on game over, a cylinder, a few 3D text objects and a few quads rotating with stars. All movement is being handled with transform.Translate (I have also tried every other possible combination of moving everything but nothing helped with the stuttering or the collision issues). As you can see from the image, the game is VERY simple, but because it's fast paced, the pauses are really noticeable and the game is difficult enough without these hiccups! ![alt text][1] It also needs to be noted that these issues ONLY happen on iOS, on all of my devices (iPad4, iPhone 4, iPhone 4S, iPhone 5C). What's even stranger is that I get a perfect 60fps on all devices, even the 4, so I'm certainly not doing anything to test the grunt of these machines! Here is my collision code and yes, I tried with triggers/colliders too, still have the issues. I've even tried using box colliders instead of mesh colliders... NOTHING works! function CheckCollision() { RayStartPos = _rayEmitterTransform.position; if (Physics.Raycast (RayStartPos, transform.right, hit, fRayDistance) || Physics.Raycast (RayStartPos, transform.forward, hit, fRayDistance * 2) || Physics.Raycast (RayStartPos, -transform.right, hit, fRayDistance)) { bGameIsOver = true; } else { Debug.DrawRay (RayStartPos, transform.right * fRayDistance, Color.green); Debug.DrawRay (RayStartPos, -transform.right * fRayDistance, Color.green); Debug.DrawRay (RayStartPos, transform.forward * (fRayDistance * 2), Color.green); } yield; } [1]: https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-frc3/t1/1959250_590622711031304_1329120180_n.jpg

Making enemy health drop if players sword hits enemy

$
0
0
Alright guys, title basically explains it all. How would I make it so that if the players sword hits and enemy, the health drops. I have a combo system set-up with mouse clicks, click once attack plays, click twice within a certain amount of time attack2 plays, and click three times within a certain amount of time, combo plays. How would I make it so that each time the sword swings the enemies life drops and more damage per attack combo? I'll be going to bed here shortly so i'll be on tomorrow if anyone needs me to post codes/scripts. Thanks a lot!

FPS drop when screen is covered

$
0
0
Hello, within my game there's a section with water which is just a quad but whenever my characters enters the water I suffer from a -20 frame rate drop. I'm 100% sure it's becasue it's covering the screen but I don't understand why (If I disable the renderer for the water I don't suffer from the FPS drop). I'm using the standard Transparent/Diffuse shader so that I can adjust the alpha on the water so I'm assuming it's that, does anyone have any advice on how I can overcome this? I need the water to have an alpha value so you can see the character.

Frame Rate gradually decreasing when Spotlight is adjusted ingame

$
0
0
Good day. I implemented a script to gradually decrease the light source of my character in game. This serves as the game's timer. I use a Spot Light as the light source and adjust its spot angle proportional to the elapsed time. However, I observed that the frame rate drops gradually as the light depletes. I'm wondering what's causing this behavior or is it the light that really affect the game's frame rate. Below is my code for the Spot Light adjustment. private void UpdateLight() { this.timer.Update(); float timePercentage = (this.duration - this.timer.TimeElapsed()) / this.duration; float newAngle = this.light.spotAngle; if(timePercentage > 0.75f) { newAngle = this.lightPower; } else if(timePercentage > 0.50f) { newAngle = (0.9f * this.angleRange) + Constants.MIN_LIGHT_ANGLE; } else if(timePercentage > 0.25f) { newAngle = (0.75f * this.angleRange) + Constants.MIN_LIGHT_ANGLE; } else if(timePercentage > 0.1f) { newAngle = (0.25f * this.angleRange) + Constants.MIN_LIGHT_ANGLE; } else if(timePercentage > 0.0f) { newAngle = Constants.MIN_LIGHT_ANGLE; } if(this.timer.HasElapsed()) { RenderSettings.ambientLight = Color.black; Destroy(this.gameObject); } if(newAngle != this.light.spotAngle) { this.light.spotAngle = newAngle; GameManager.Instance.StrataHud.UpdateLightBar(timePercentage); } } There's a flag for my light source which tells if the light is permanent or depleting. The frame rate drop happens when the light is depleting which is the condition for UpdateLight function to trigger. The UpdateLight function is invoked in the Update routine of the object. If it will help, my scene is made up of tk2d sprites with lit shaders. It's tile based and so far I'm playing on a 18 x 35 tile scene with each tile measuring 256px by 256px. I'm using the free version of Unity. If it helps, here's my list of the running processes. Not sure if I can enumerate them all but this is what I've reviewed so far: - character movements (current action of character and monsters) - HUD processes (progress bars, label changes, notification handling made up of text) - Hint detection (triggered periodically by specific type of objects in order to trigger the hint arrow. This is done by measuring the vector distance from the character to the object. Each hintable object has this process)

Interstitial ad kills framerate in different scene.

$
0
0
Hi, I have some problems with interstitial ads in my game for android. Here's what happens: After the ad has popped up and you close it, the framerate goes down from 60 to 30. In the profiler you can see that something is added to the "Overhead". This makes the game lose a couple of frames and the Device.Present kicks in(I have VBlank turned off), making the game run in 30 fps. The funny thing is that the problem only occurs on one of my testing devices, a Sony Xperia V (LT25i). It does not seem to happen on less powerful devices, only this one. The other strange thing is that the lack of framerate continues to other scenes, eventhough the ad has absolutely nothing to do with the other scenes. Obviously something is left from the ad that the CPU still chews on, but I have no idea what it could be. Hopefully someone can help me, thanks in advance, Martin. I am using Unity Pro 4.3.4f, Appnext and its SDK, interstitial ads and have tried it on: *Samsung Galaxy SIII - Runs fine *Sony Xperia Ray - Runs fine *Sony Xperia Go - Runs fine *Sony Xperia V - Problem

CaptureScreenshot

$
0
0
Hello, I have a little performance problem with Application.CaptureScreenshot function. It's 2D scrolling game for IOS. When the player dies, I capture screen by CaptureScreenshot. But it drops half of the FPS and lags. (from 60 to (30~45)). Without capturing screenshot, FPS doesn't drop and the game hasn't got any lag. I have tried to reduce hitches by lerping timescale to 0.5. It improves little bit but not quite enough. Does anyone know best way to take a screenshot? Thanks in advance.

Framerate Drop With Objets

$
0
0
So I have a horror game where I have just started creating the environment and I just added the trees (there are lots) and now it gets an average of 20-30fps which is terrible. It had almost 300+ before the trees were added (without vsync etc) I was wondering what could be causing this and if there would be anyway way to fix it or increase the framerate? Any help would be appreciated :)

Unity Android lag when close to terrain

$
0
0
I have a simple Unity Android scene with a terrain with some textures. There are no trees, grass etc. and the texture-size is very low. I test my game on high-end devices. Usually, there are no problems when I'm making terrains for Android, but something went wrong here. When my camera is close to the terrain, the framerate drops to about 15FPS but if my camera is 100 meters above the terrain (facing down), the framerate is about 40-50FPS. I have tried this: Changing camera Far Clipping Planes Remove textures from the terrain Set basemap distance to zero. There are no problems in the editor. I have spent a lot of time on this terrain, so I really don't want to start all over... Thanks in advance. Andreas.

Low FPS at low CPU usage

$
0
0
Situation: User can instantiate over 40 objects per click (these objects are then initialized, and drawn by GUI.DrawTexture) that later fly through the screen. After some time these objects fade out and get destroyed, but since this process is somewhat slow, user creates objects faster then they disappear. Anyway, at some point I reached 5 fps. But my CPU usage is under 30%, and my GPU is definietely not the case. What is the cause of this problem?

Why is our framerate hurt by adding in ads?

$
0
0
We implemented some Lifestreet ads in our Facebook Unity3d game. After doing so we see a big drop in our framerate. They look like simple animated ads and they run some Flash code and are in separate html divs so we didn't think it would have an effect on our game. Any ideas why the drop in framerate? Below is the example code they gave us to implement: Application.ExternalEval( "var jscript = document.createElement('script');" + "jscript.setAttribute('type', 'text/javascript');" + "jscript.async = true;" + "jscript.src = '//ads.lfstmedia.com/getad?site=25000';" + "var stag = document.getElementsByTagName('script')[0];" + "stag.parentNode.insertBefore(jscript, stag);"); Application.ExternalEval( "var ad_div = document.createElement('div');"+ "ad_div.setAttribute('id', 'lsm_ad_div');"+ "ad_div.style.textAlign='center';"+ "var body = document.getElementsByTagName('body')[0];"+ "var insertionPoint = body.children[0];"+ "body.insertBefore(ad_div, insertionPoint);"+ "(function delayedAdBuilder() {"+ "if (typeof LSM_Slot !== 'undefined') {"+ "LSM_Slot({"+ "slot: 'slot25000',"+ "adkey: 'fff',"+ "ad_size: '728x90',"+ "_render_div_id: 'lsm_ad_div'"+ "});"+ "} else {"+ "setTimeout(delayedAdBuilder, 20);"+ "}"+ "})();" );

Massive performance drop when placing same mesh in same position

$
0
0
Hi everybody, due to a bug in my application I placed several (equal) meshes in exactly the same position. This caused a massive framerate drop (from about 500 fps to 30 fps). Another issue was that the closer I get to the multiple meshes the worse the framerate became. When I moved away for about 50 m the behaviour was almost normal again. The error is fixed now and everything is back to normal again but I don't understand why this bug caused such a behaviour. Could someone elaborate on this? I just like to understand what happened. (It obviously has something to do with shadows and culling.) Thank in advance! G.

Low FPS because of changing sprites

$
0
0
I am making a top down 2D zombie shooter game. Much like the SAS games, there are barricades in the game. The barricades consists of 6 sprites. The sprite that is shown depends on the amount of hitpoints that the barricade has. If the barricade has 90% hit points left, the sprite is changed, if it has 75% left the sprite is changed and so on until the barricade is broken. The problem is that I get around 21 FPS when there are 4 barricades being damaged by zombies. As soon as the barricades have either broken or the zombies are killed the FPS goes back to about 200. Why so? Is this a bad method for sprite rendering? This is one of my first games, keep that in mind! This is the code: if (gameObject.GetComponent ().currentHealth >= maxHp) { gameObject.GetComponent().sprite = undamaged; } if (gameObject.GetComponent ().currentHealth ().currentHealth > maxHp * 0.75f) { gameObject.GetComponent().sprite = damaged1; } if (gameObject.GetComponent ().currentHealth ().currentHealth > maxHp * 0.6f) { gameObject.GetComponent().sprite = damaged2; } if (gameObject.GetComponent ().currentHealth ().currentHealth > maxHp * 0.45f) { gameObject.GetComponent().sprite = damaged3; } if (gameObject.GetComponent ().currentHealth ().currentHealth > maxHp * 0.3f) { gameObject.GetComponent().sprite = damaged4; } if (gameObject.GetComponent ().currentHealth ().currentHealth > maxHp * 0.15f) { gameObject.GetComponent().sprite = damaged5; } Appreciate some answers!

Huge Framerate Drop

$
0
0
I'm working on a 2D game. When the camera moves it instantiates about 10-15 UI texts on the screen to show specific things. When it does that, the framerate drops from 100fps to 10fps! This is not normal. Here's the profiler: ![alt text][1] [1]: /storage/temp/55639-untitled.png Can anybody hint on what's going on??

Is there a reason this script should lower fps by 10-15 frames?

$
0
0
This script when enabled on my object lowers fps by 10-15 frames, any reason why? I'm pretty sure its the vector3.movetowards but I really badly need it, are there any alternatives that are more performance friendly? using UnityEngine; using System.Collections; public class EnemyMovement : MonoBehaviour { public float movementSpeed; public float animMovementSpeed; Animator animator; public GameObject player; public float distance; public float minDistance; // Use this for initialization void Awake () { animator = GetComponent(); player = GameObject.Find("Player"); } // Update is called once per frame void Update () { if (distance > minDistance) { transform.position = Vector3.MoveTowards(transform.position, player.transform.position, movementSpeed * Time.deltaTime); animator.SetFloat("MovementSpeed", 1.0f); } if(distance transform.position.x) { transform.eulerAngles = new Vector2(0, 180); } else { transform.eulerAngles = new Vector2(0, 0); } } }

Choppy gameplay / frame skipping in build

$
0
0
I threw together this scene with minimal detail, no trees just grass on an island. Yet even at the lowest possible resolution and lowest graphics quality I still get heavy frame dropping. Every second it skips as demonstrated in this video.[link text][1] [1]: https://www.youtube.com/watch?v=OgPFEvS5uls&feature=youtu.be It's worth mentioning I have a decent rig that runs Farcry 4 smoothly at nearly maximum settings so how can this simple scene be so choppy?

2D Board Game Movement Script Results in Empty Calculations

$
0
0
Okay, so I have a function that generates a list of possible moves one can make. From this function, tiles are overlaid with a blue highlight. When clicked, this highlight should move the selected character, provided there are no enemy characters on it, to the tile. void OnMouseOver() //Snippet from the Movement Highlight's attached script { print("Get off of me!"); if(Input.GetMouseButtonUp(0) && !UIMan.UIActive) //if we left-click and we aren't drawing any menus { print("!HERE!"); if(overlaidOver.stoodOnBy == null) //if no character stands on this tile { PersonThisBelongs.StandingOn.stoodOnBy = null; //the tile the selected character is standing on: no longer stood on PersonThisBelongs.gameObject.transform.position = overlaidOver.gameObject.transform.position; //set the character's position to that of the clicked-on highlight square PersonThisBelongs.StandingOn = overlaidOver; //the character is now standing on this tile overlaidOver.stoodOnBy = PersonThisBelongs.gameObject; //the tile is now stood on by the character PersonThisBelongs.canMove = false; //the character can no longer move this turn GameMan.CloseEye(); //removes any pathfinding data and deselects the character //Move the character to that tile } else if(!overlaidOver.stoodOnBy.GetComponent().team && overlaidOver.stoodOnBy != PersonThisBelongs) //if we are clicking on someone on our team //& they are not the one we have selected { GameMan.CloseEye(); GameMan.TheEyeIsWatching(overlaidOver.stoodOnBy); //call the deselection cleanup method //select the new character } } } UIActive is false, but we don't even reach the second print statement. Also, when a movement highlight square is clicked, the game drops to about 30 fps for a split second presumably doing calculations before spitting out nothing. The movement highlight, tiles they are over, and the characters all have 2d box colliders attached to them. I can provide other snippets of code if they would be helpful, but this is the problem function at the moment.

Optimize game for beginner understanding

$
0
0
Hi. As first I want to say that I'm using Unity 5.3. I started in this program about week or two ago so I'm not such as expert and I was looking for how to optimize game but it's kinda hard for me, as begginer and total noob in this stuff, to understand it and make it good. I'm getting big frame drops like for 5 - 15 fps, even when I'm looking there where is the most stuff from so far. There are water4advanced (4x), several dozen trees and about 70/80 particle (they are soo far from this place when I see on this all and frame drops are for 5 - 15 fps so as I think, at least I, that I think they are not so big problem with frame drops as they are so many but I guess they are too far to make these troubles etc.), and others of course but others are normal objects which shouldn't be much as problems with it. As next one is that I'm using for this game FPS controller from import package from Unity. I do really please in helping me in optimize it as it's impossible to play in 5 - 15 fps to get fun. As second I need as easy explaination as it's possible 'cuase as I said I'm begginer and I would not understand something, but let's try.

Unity Not using GPU anymore for anything

$
0
0
Unity will not use GPU for any tasks. Consistently low FPS on any project due to this. I have tried turning global power settings in NVIDIA panel but no difference. Anyone? Is there a Disable GPU issue i am missing within unity lol! Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 CPUs), ~4.0GHz GTX 970 32G Ram

Massive framerate drops because of terrain

$
0
0
Hey, so since a time I'm doing a game for fun and to this point it all worked fine but there is a BIG issue now with the game and the issue is when i walk against a chair like you see in the video my framerate drops to ~10 fps and I think it's the terrain even if I don't know why but when I turn it off it all works fine and I don't have many details on the terrain I only have a bit of grass and I think it causes the issue especially . Video: https://youtu.be/M_d0n8UVCzI Settings Image: ![alt text][1] Terrain Image: ![alt text][2] Profiler Video: https://youtu.be/wrc4wnXlu0M Thank You in advance! :D [1]: /storage/temp/71609-terrainsetup.png [2]: /storage/temp/71612-terrainpic.jpg

Shadows massive lag

$
0
0
Hello! I've been working on my game for some time, and just now I encountered some horrid FPS problems. I have 24 lights in my scene, both of which have soft shadows. I'm using the deffered lightning rendering path. I have a terrible computer, however I sent a copy of the game to a friend of mine whose computer is a beast, but played only on 20fps on fantastic. How am I sure it's the shadows that do this? I've tried opening the profiler window which said that 70% of the CPU ussage is coming from the shadows. I've tried many things, such as reducing the shadow quality, shadow distance and all that. It didn't help at all though, only when the shadow distance was under at least 3. Is there any way to optimize them? I'm using Unity 4 by the way. Thanks!
Viewing all 141 articles
Browse latest View live




Latest Images