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

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

Related

Image target rotating on play - Unity

I've been tearing my hair out with this one all week. I am building on Unity for Android, and every time I press play to test my project with my webcam, when it detects the image target, it seems to change rotation! I'm not sure if this is supposed to happen, but my problem is manifesting with my Skybox not rotating with the image target, so my scene is all messed up, instead of my sky being up, it's sideways, if that makes sense. If you help me solve this you will forever have bought my friendship and loyalty, lol, seriously though, I'm losing it, it was working fine before, please help me. Alan.
I am using Enviro for my skybox, I tried rotating it and the camera, I installed a new version of Unity, deleted cache, and tried writing a script that rotates the skybox with the camera, I'm terrible at coding, but nothing seems to be working.

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.

Splash screen not showing on hololens

I'm building a Hololens app in Unity.
Lately the splashscreen is only showing for a split second and is also frozen, if i move my head it has graphical glitches, the same you see when your hololens is experiencing heavy load in the background.
How can i determine the cause of this problem?
I tried looking at my awake functions, since i read they are run in the background while the splash screen is shown. They don't seem to be the issue though.
Any thoughts on things i could look into?
I found the problem by going back through the commits.
It stopped working when i assigned mesh colliders to a big object in the scene. I guess the scene is loaded in the background while the splashscreen is shown and mesh colliders are even less performant than i thought.

Spritekit FPS drops when presenting UIView

I am finishing one of my project, a game made with Spritekit.
I created a small menu with UIKit (1 view and few buttons).
I connected SKScene and View Controller class to communicate so when game is finished, I am able to present menu.
I noticed problems with SKScene FPS.
I already found some informations from 2015, on apple developer forum that this problem was spotted with iOS 9 for the first time.
When I'm presenting UIView over SKScene, my FPS falls from 60 to 40.
And after I hide UIView and run game again, FPS increases back.. But in about 2-3 seconds, what gives me a lag in my animations on start of the game.
I tried with preloding all texture atlases first and nothing changed.
Than I tought my textures are too big and problem is in my animations, and I decreased all images and its quality from 32bit colors to 16... But problem was not solved.
Then I also noticed that FPS is worse, if I animate UIView..
So there is definetly problem with combining SpriteKit and UIKit.
I could pause scene before presenting UIView and unpause second or two after my view disappear again, and yeah maybe users wouldn't notice problem..
But what if I want to run my Scene in background of my UIView (like endless scrolling backgrouns), so background would move constantly when user enter menu?
I know, I could do the menu with SpriteKit, but this approach seemed to work fine 2 years ago when I was last time using SpriteKit.
Okay.. I am posting an answer, if somebody else is searching a solution for similar FPS problems.
After your comments and recommendations what to do, I tried few different things and figured out some problems.
I tested it on two physical devices iPhone 6S and iPad 2. Of course results on iPad 2 are a bit worse.
UIKit and SpriteKit are surely not working best together.
I figured out that there are no big problems with just presenting other UIViews or UIButtons over SpriteKit scene - FPS drops a bit but not really much, that this would make some big impact on your scene (2-3 FPS).
Biggest problems came in if you're trying to animate Views with some basic animations. In that case FPS (in time that animation is happening) drops to 40 - 35 FPS, and the biggest problem with this is, that sometime it just wont raise again until you make another animation or run scene again.
I still don't know why this is happening, but it happens randomly. Sometimes FPS raises and sometimes not.
Another thing that also have big impact on SpriteKit frame rate are Ads if you're using them.
I am using AdMobs and in their documentation it's well written, that Banners or Interstitial Ads can make impact on your frame rate. I am not presenting Ads during gameplay, but also if you're presenting them in menu, this will decrease your FPS and when you run your game and your FPS drops again for a bit, the result will be even worse.
So I suggest you run your Scene with delay or hide banner a bit earlier so it won't have impact on your start of the game.
I found solution for my problem with pausing the scene as soon as gameplay ends, so when menu appear my Scene is on pause mode. And after I run my game again I am un-pausing my Scene. It's not the best solution for my case, but it works much better now.
I suggest to use SpriteKit also for your menu creation, this way you won't have such problems. Or even better - use some other game engine for your game creation.

Unity - LoadLevelAsync hiccups on scene switch

I am trying to make a loading animation while using LoadLevelAsync to load the next scene.
The loading animation is a loading circle that continuously rotates in the middle of the screen, and I use LoadLevelAsync("NextScene") in the code. The problem is that every time right before the scene switch happens the circle will freeze for a few milliseconds before the next scene appears.
I do know that the less things the next scene contains, the shorter the freeze is, but I thought that LoadLevelAsync's purpose was for letting the user experience no lag during scene transitions. My next scene contains a background sprite, some buttons, scripts, and a 3MB audio file. The screen will always freeze for half a second before showing the next scene.
I am using Unity 4.6.3 with Pro feature. I'm also testing the results on a device. I have also tried out the AsyncOperation.allowSceneActivation with Coroutines, and unfortunately they don't work.
If anyone has a solution, or has any suggestions on smooth scene transitions, I would greatly appreciate them.
Thanks in advance.