How to Debug SpriteKit Forces - sprite-kit

In my SpriteKit train game, sometimes I get a strange behaviour. Most of the time everything works fine. But sometimes the engine sprite gets an impulse, so it moves out of the tracks.
I checked my entire code if there are some applyForce(), etc. But the impulse comes from SpriteKit, but I don't know why.
Is there a possibility to debug SKPhysicsBodys so that I can identify the cause of the impulse?

Related

Unity 2020.3 When I click play sometimes it shows my game upside down

I use Unity 2020.3.8f1. I've developed a scene with an FPS controller so it can be walked through. Yet, sometimes when I click play, the scene shows upside down and sometimes the camera is looking at the sky or off to the side. It doesn't happen always, just randomly at unpredictable moments and looking in different directions. Does anyone have any idea what is going on?
It happens only with this one file. I've created other scenes with FPS controllers to walk through that have always worked with no problem. With this error=prone walk through, there are no errors in the console and no error messages appear on screen. The scene was built with prefabs, so the only scripts are the ones that come with the FPS Controller.
Thank you,
Michelle Jensen

Unity 3D: Adding rigidbody to sphere crashes frame rate

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.

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.

sprite kit swift initial slow frame rate/ lag?

I've just started learning how to use sprite kit, I've almost completed my first game, however I have come across a problem which I don't really know how to solve, basically when I first load the game/scene the game is very laggy FPS drops to about 30, and movement and animations are not smooth, however soon as the first scene is finished and play again everything is super smooth? so initial load is slow, second and every load after that is fine, I need some pointing in the direction, thanks

SpriteKit gravity falling objects erratic jitters/choppiness

I'm generating random falling SKSpriteNode objects in my scene. I noticed that sometimes the falling objects fall smoothly and sometimes they are jittery. It is more noticeable when I set the gravity at -4. I've been trying to figure out this erratic behavior but no success. However, I noticed also that the choppiness seems to disappear when I transition to a different scene and then transition back - sometimes I have to do it several times. The scene is running at a consistent 60fps even if the objects fill the screen. I've checked for areas where I might be bogging down the flow but even if I remove those possible areas it did not help. Has anyone experienced this behavior before? Thanks in advance.