Unity 3D: Adding rigidbody to sphere crashes frame rate - unity3d

There is a strange issue happening in Unity 3D: I have an empty scene, then I add new sphere game object, press run, the ball stays stationary. I can see in the Game window that FPS are ok.
Then I add Rigidbody component to the same sphere and press play. The sphere starts to fall down as it should, but the frame rate drops dramatically, that is below 3 FPS.
I've updated the Nvida drivers, I also tried this in both 32 and 64 bit newest Unity versions.
It seems that there something wrong with the physics calculations.
Does anyone experienced similar issues?
Any tips on how could I debug this issue further?

Some times Vsync can act as the FPS dropper.
so check Edit>>Project Settings>>Quality>>V Sync Count
Set V Sync Count it to Don't Sync.
it should increase your FPS.
if it does not help than you might have some script that is acting as weird.
so try Profiler .Go to Windows>>Profiler .
and run your game see what is taking your highest CPU.

Related

Unity Oculus Quest game stutters/lags when head is moved from side to side

Firstly, I've built for the Quest and checked the Unity profiler - everything seems good.
The weird thing is, when I move my head from side to side I don't see any framerate drops in the profiler but I see a noticeable stutter/lag in the headset. When my head is still or even just rotating, everything looks great, there's no stutter at all.
This stutter only occurs when I'm close to my UI and moving my head. When my head is static or rotating, it's all good. If I move back from the UI, there's no stutter either.
I don't think that it's an issue with too complex geometry or materials, as surely this would show up as a framerate drop in the profiler. I'm guessing that the camera movement is causing some kind of frame mismatch which (for some weird reason) isn't showing up in the profiler.
Does anybody have any ideas as to what might be causing this?
Well, I found the issue after narrowing the issue down to a specific set of GameObjects. It seems that the issue was being caused by a custom 'Dissolve' shader I was using. After setting the shaders back to 'standard' the problem went away! Weird...
This happens if your game FPS is lower than the device refresh rate.
For example if the headset is displaying 90 frames per second and your game is only able to render 70 frames per second, the headset needs to reuse a rendered frame every few frames.
When the game doesn't provide a rendered frame in time the device will just take the last rendered "image" and adjust it to the changed headset position and rotation. If it's a rotation change only, you will not notice, because the headset can easily just rotate the last image. But if it's also movement, the device can't simulate the difference of movement of close objects versus far objects on the image, so if you are moving an object close to a camera (e.g. your hand), it will stay at the same position for two frames (every few frames), which will make it look like it's stuttering.

Unity is showing different physics behaviour while building for different devices

I am working on roulette(Casino Style game) game project in Unity3D.
I am rotating a ball around a wheel and wheel is also rotating on its own axis in fixed update.
I am using transform.RotateAround function to rotate the ball around the wheel and i am also decreasing ball's speed in fixed update.I am assigning a random initial speed to ball within a range such that it always stops on different position each time .
For testing purpose i kept the initial ball speed to constant and check it in unity editor such that every time it rotates it always stops on the same number.
I build this project to android and PC .Though the ball stops on the same number each time in both android and PC build but the result is different in both of them.
For example- Every time ball rotates it stops on number 8 in android and number 20 on Pc each time.
Can somebody please suggest me some ways to obtain same result on different devices?
Why it is happening? Is unity physics behaviour is different in different processor?
and please explain me how to fix that .
Unity has a fixed time step, so that isn't the cause of the differences as one might expect. Physics simulations are incredibly complex things, so I'm not going to pretend that I know exactly why you're seeing differences. However, I would imagine it is to do with floating point precision differences between your computer and a much smaller phone processor.
One way to test this would be to run the simulation on another computer, and compare the results to the both of your current devices.

Unity 2D box collider falls into another and than ports Playercollider upwards

I try to make my first Unity 2D game (it should end up to be a brawler) and i have a little problem with my colliders. My player collider straight falls a little bit into my scene colliders(the player starts ) and than the program realizes that this shouldn`t happen. It ports the player upwards. Now the player falls again and again he ports upwards. After 3 ports the player lands on the ground and can be used until he collides with another edge and than the same problem occures. I can even fly straight into the scene() collider itselfe sometimes i glitch out but sometimes i fall father down...
Can someone say me how to fix this?
Greetings and thanks for all answers
(BTW. I am sorry for my bad English i hope u can understand it)
You can play with Unity's physics 2D settings.
Most relevant to your problem seem to be:
Position Iterations (try to raise it)
Velocity Threshold (try to raise it)
Min Penetration For Penalty (try to lower it)
Baumgarte Scale (try to lower it)
A more accurate physic simulation is more expensive at runtime so try fixing your issue by tweeking just enough or your game will get slow.

Unity 3D low fps

I'm using Unity3D 5.3 version. I'm working on a 2D "Endless running" game. It's working normally on PC. But when I compile it to my phone, all of my gameobjects are shaking when they are moving. Gameobjects are in a respawn loop. I'm increasing my Camera's transform position x. So when my camera is in action, all of the other objects look like they are shaking a lot and my game is working slowly on my phone as a result. I tried to play my game at Samsung, on discovery phones. It's working normally on some of them. But even on some Samsung devices it's still shaking. So i don't understand what the problem is. Can you help me with this?
One thing you can do is start optimising, if you have a game that is either finished or close to it. If you open the profiler, click "Deep Profile" and then run it in the editor on your PC, you'll get a very detailed breakdown of what is using the most resources within your game. Generally it's something like draw calls or the physics engine doing unnecessary work.
Another thing that might help is to use Time.deltaTime, if you aren't already. If the script that increases the transform doesn't multiply the increase by Time.deltaTime, then you're moving your camera by an amount per frame rather than per second, which means that if you have any framerate drops for any reason, the camera will move a smaller distance and that could be throwing out some of your other calculations. Using Time.deltaTime won't improve your framerate, but it will make your game framerate independant, which is very important.

Andengine A Moving Ball example, juddering / lag

In the Andengine "A Moving Ball" example, I experience a "jump" in the animation every 5 seconds or so ie. The lateral movement is not always smooth, it seems to skip a few pixels. I'm running this on a Samsung Galaxy SII. I also noticed this on the emulator.
A Moving Ball example
This is a problem for me as I'm creating an environment of ten bouncing balls and every few seconds I get this judder effect.
I'm looking for a very consistent movement, similar to say the baloons in "Crazy Pill":
Crazy Pill
Has anyone noticed this occassional lag or any idea how to create a smooth movement?
Thanks
see if this discussion and solution helps
Jittering texture when using BoundCamera