Does Google Cardboard SDK work with Unity 5? - c#

I have converted my working project from Unity into Unity 5 and now the stereoscopic display doesnt work.
It seems like the stereoscopic effect doesnt work. The display is split in the middle, and the shader is applied, but it seems like there is only once camera. Like there are no eye cameras.
The weirdest thing is that everything works perfectly in the editor, but when I run it on device it seems like the cameras are disabled.
I went through and tried everything in the "known issues" in Cardboard SDK Release Notes, but nothing works.
Has anyone succesfully run a Cardboard game on Unity 5?

Yes, I have done. Mine isn't big one but has major things that can be said to be using UNITY features as well. I cant predict your problem as such but Answer to this post is certainly YES.

I don't think that anyone has posted this yet, but it appears that the SDK is currently broken in Unity 5.
From: Cardboard SDK Release Notes
Unity 5 rendering issues: As of Unity build 5.0.0f4, the following steps should be taken to fix or ameliorate any rendering issues, such as an all-black screen, flashing textures, or non-stereo views:
Enable the Development Build option in the Build dialog. This seems to fix various rendering glitches, like flashing textures.
The root cause of the rendering glitches is under analysis, with assistance from Unity.
I have also found that the app has rendering issues when it initially runs when you hit "Build and Run". Closing the app from the task switcher and restarting seems to resolve the issue.

Related

Unity 3D freezing after leaving Game Mode (MRTK)

I've been working in a project some weeks now in a Mixed Reality project using Unity and MRTK and I've found a strange behaviour when adding screen capture to the application. I'm using Unity 2019.4.26f1, and I haven't found any issues so far but after adding this line of code
ScreenCapture.CaptureScreenshot("test.png");
into a script, I've realised that when I press Play and go into Game mode, everything goes correctly (the game starts, the screenshot is taken). BUT when I stop it and try to go into Play mode again, Unity freezes. If I don't press Play again, Unity still works until it tries to compile scripts or some heavy task like that, when it freezes and can only be closed with the task manager.
If I remove that line, Unity goes back to normal.
This issue cannot be reproduced in Unity 2020.3 LTS. Does this happen when the remoting play or in Editor? According to Choosing a Unity version and XR plugin - Mixed Reality | Microsoft Docs, if you target to HoloLens 2, please upgrade to the recommended 2020.3 LTS version that is stated in the document.
In addition, ScreenCapture is a Unity built-in class and if there are any usage questions, you may find support from Unity forum.

Are there browser/system security measures that can block Unity WebGL projects?

The PROBLEM
I am currently building a simple website containing Unity WebGL projects for a client. The games are working on all browsers for me, my teammates, and my producer, but one of the games does NOT work for our client (on any browser, Mac, or Windows).
All the games are embedded in a div in the exact same manner. There are no discernible differences between the build settings or output for each of the games. Unfortunately, I only have access to the Unity project for the game that is not loading for the client.
THE CLUES
While on a call with the client where he shared his problems, he specified the game in question did not load at all in Chrome (not even a rectangle appeared) and crashed in Safari (rectangle appeared first). The other games on the website loaded for him normally. Over the course of the conversation, he mentioned that he could not share his screen due to security limitations/software on his device from work. All of the games are built with 2019.4.15f1.
The only odd thing happening on my end is that the Unity logo is not appearing while the game loads as it typically does for games w/the free license.
THE QUESTION
Are there any settings or known problems within Unity for WebGL that can cause this type of issue? Due to the fact the other games work fine for him, I suspect there is some setting in my build that is causing it to trigger his security. Thank you for any and all suggestions!
Edit: We are hoping to avoid asking our client to print and share their console, just to maintain professionalism.

Unity editor frame drops on Mac

I'm trying to use Unity in a Mac but the editor drops frames all the time. It shows it's rendering 330 fps but still feels laggy and dropping frames, also enemy movement is weird (I think it´s because it's dropping frames). This doesn't happen on windows (I tried both platforms). Before I used metal, and it rendered 35 - 45 fps dropping frames too. When I switched to OpenGL it went up to 330fps. I think the problem is not performance, but incompatibility of some kind. When I play the game built for Mac it works well.
Any idea of what could it be?
Statistics using OpenGL:
Statistics using Metal:
Make sure metal is enabled in the editor (not just when you export the game).
https://docs.unity3d.com/Manual/Metal.html
in old unity version metal was not enabled by default on mac and you had to use -force-gfx-metal and start the editor with terminal command line.
If it still not working I'm not sure what you can try... maybe try also to change your screen res.
Remember that Unity editor always use more resource, if the game is working fine when you export the game you can ignore the problem.

Unity Google Cardboard display issue on iOS

I've never encountered an issue like this before and everything I've tried to fix it has achieved nothing.
We have an app that uses Unity's built in Google Cardboard support that we have available on Android and iOS. The issue has never appeared on Android before, and also doesn't appear in a different project we have created using the same version of Unity (2018.1.1).
It appears the somehow when configuring the separate viewports for each eye it seems to get confused. The aspect ratio has been squished vertically and is stretching the displayed image. On top of this, the left and right eye appear to be facing in a cross eyed manor, where they should be facing more-or-less in the same direction. Here is an image representing the issue, with a line drawn around the current display area for each eye:
iOS cardboard display
This picture is of an iPhone 6, however this has been replicated on multiple devices including iPhone 8, iPhone X, and a few others that I cannot recall. Like I mentioned previously this has never happened on Android and also does not appear on iOS in a similarly setup project.
I have a suspicion that it has something to do with the way my Unity scenes are setup so I'll give a brief description of how things work at the moment.
Scene 1 - Menu scene
This is an entirely UI based scene (like most menus) and is setup in Portrait. It has a main camera that remains in standard mode (non-VR).
Scene 2 - Experience scene
This scene switches into Landscape view using code Screen.orientation = ScreenOrientation.Landscape. It has one camera in the scene that is initially in standard mode (non-VR) but can be toggled into VR using a button with this code:
public void SetStereoViewState(bool isActive) {
XRSettings.enabled = isActive;
#if !UNITY_EDITOR
// if device is a tablet (> 7" screen) always disable cardboard switch
// otherwise display only when cardboard mode is inactive
overlayCanvas.gameObject.SetActive(ScreenUtils.IsTabletDevice ? false : !isActive);
// needed to fix the aspect ratio when switching back to mono mode
vrCamera.ResetAspect();
#endif
Debug.Log("XRManager::SetStereoViewState | Enabling VR: " + isActive);
}
In a previous version of this app (running Unity 2017.2.0p2) this was never an issue, and is not an issue in a separate project also created in 2018.1.1.
What I've Tried So Far
camera.ResetAspect() - This was here to fix aspect issues when switching for VR to non-VR. I have enabled and disabled this when switching for every which way VR -> non-VR, non-VR -> VR etc. I have also delayed this until the next frame but without any change to the results
Enabling 'Cardboard' mode in the Landscape scene - The way I have always set my scene up in the past is to XRSettings.LoadDeviceByName({device_name}) at launch, in this case XRSettings.LoadDeviceByName("cardboard") but not enabling it with XRDevice.enabled = true until it is actually needed. | VR XRDevice.enabled = true - Non-VR XRDevice.enabled = false
Camera Setup
I don't think it's relevant since VR works perfectly fine on Android, but here is my somewhat default camera is setup:
Unity camera setup
I have considered setting up multiple cameras (left and right eye) but I can't see how this would make a difference as the aspect ratio is one of the issues.
If anyone has experienced a similar issue and has a fix, or has any advice in how to approach the situation in a different way that would be awesome.
NOTE:
Currently we are using Unity 2018.1.1 but I have also tried up to the most recent (at the time) 2018.1.5. A downgrade to 2017.x.x is not really possibly due to HttpWebRequests and Apple's somewhat frustrating IPv6 requirements which are broken until Unity 2018.x.x
FIXED
The issue is when loading 'cardboard' mode while in Portrait. Here is the code that I run at app launch to solve the issue:
private IEnumerator SetupCardboard() {
Screen.orientation = ScreenOrientation.Landscape;
XRSettings.LoadDeviceByName("cardboard");
yield return null;
Screen.orientation = ScreenOrientation.Portrait;
}

Can't run XNA APP

i'm getting started with XNA game development and tried to run tutorail app on http://create.msdn.com/downloads/?id=753&filename=Shooter_Project_Windows.zip, but when i run, this blue window appears insted of emulator
What's wrong?
There is no way to know what is wrong for sure without more info. The blue window you are seeing indicates that the project is running; it is just not displaying anything visible to you.
If I had to guess (and it's just a guess, but it's a common issue for these types of things), the issue is possibly that your camera is facing the wrong direction. Other potential problems include things like the clip planes being set incorrectly. You might also look at the console to see if something failed without crashing the program...if a mesh or something was supposed to be loaded, and failed for some reason, you might also not see anything.

Categories

Resources