I have a bug plaguing my project that I can't find any resources to online. There are 2 scenes in my app, Menu and Game. Menu has this behavior 100% of the time, whereas Game only loads with this glitch occasionally. It appears that once it happens once in Game, it will happen multiple times consecutively, and then eventually fix itself. Here is the image of what I am seeing: Menu scene --- Game scene
There are no scripts on my Canvas that are not standard Unity scripts, everything is stock. I have also checked the logcat log via command prompt and no errors are thrown.
If you have any information as to why this glitch is happening, please let me know. I think it has something to do with Canvas settings or a missing dependency/package conflict, but no settings that I changed caused the glitch to go away. Thank you for the assistance!
Change UI Scale mode of canvas to scale with screen size instead of constant pixel size
Answered my own question.
If you are making an AR app and have UI in the app, you NEED a regular Unity Camera in the scene alongside your AR Camera. The AR Camera should be tagged 'Main'.
For some reason, UI cannot attach to AR cameras, and while I don't understand why, the solution still works.
Related
I've written a Unity3D game and installed on Android. The game often, but not always, crashes during an operation to load a collection of image resources used by my game. Specifically the application disappears into the background and when I select it, it then restarts. At the moment I can't figure out what is causing this behaviour, I've examined logcat logs when this happens but I can't find any message telling what has happened.
Has anyone experienced similar behaviour and if so what was the solution? Is there a way of finding out why the game has crashed or increase memory allocated to it in case the game is running out of memory loading the images?
The size of images and the compression rate are configurable in the Unity IDE, and can change between platforms. In Unity 5, as a default the max size for an image is 2048 or 4096, which are not fully supported in all devices. I suggest as a first solution to go to the Unity project, select the image assets, scroll down to the setting box for each image, click on the Android tab, check the box marked "override for Android", and change the max size to 1024.
Apply the change, play test to confirm the image is still sharp enough, and re-build the game. I believe this may help you solve the issue.
Problem
Display turns black when an object that's potentially being instantiate every frame is in view
How to reproduce
Import Cardboard SDK on the Project
Assign a script to any appropriate object with the following code.
public GameObject prefab;
void GenerateObject(){
Instantiate(prefab);
}
void Update(){
if ( once ){
GenerateObject();
}
}
Attach any appropriate prefab to the prefab above on Unity inspector.
Launch the app on android device with "Build and Run".
Display turns black when an object that's potentially being instantiate every frame is in view. Settings button will also disappear. When the instantiate object is out of sight, the view turns normal. Settings button will appear.
Environment
Unity Version:5.0.0.1f
Cardboard SDK Version:v0.4.9
Device:Nexus5, nVidia SHIELD Tablet 2
There is a known bug between Unity and CardboardSDK. Try setting the build to development in Build Settings in Unity. If this fixes it, you've got your culprit.
With this error, when I wanted a build that could be uploaded to the Play Store, disabling most of the lighting in the scene sometimes helped.
We are all patiently waiting for a fix. Google and Unity are working on it together, but it is said to be a tricky one to catch.
Check out the known issues in SDK release notes.
Known Issues
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.
Note: If you are using any Image Effects, make sure that StereoController's Direct Render property is set to false. Check if
that fixes the issue first.
I had a black screen glitch and it turned out it was because I had set Stereo Screen Scale to 2 on the Cardboard script. I set it to 1 and the screen came back.
I add some textures to GL Surface, GL displays it, and I press back button,
which means the GL thread stops, the activity destroys, and my application goes onto background. After that, somehow all the texts on the menus that the next activity displays goes corrupted looking images like rectangle and never recovered.
I have searched to solve this problem in stackoverflow and found this might be related with h/w acceleration. But, it doesn't seem to work on my circumstances and I really need a essential solution to this.
Are there anyone that can help me, or experience the same problem with mine?
The release date of my app is upcoming, and any information that you have would be very appreciated.
Do you call GLSurface.onPause () at the appropriate time? Among other things, this will release the OGL Display appropriately (http://developer.android.com/reference/android/opengl/GLSurfaceView.html look at the Activity Life-cycle section).
If this doesn't fix your problem then please provide code snippets.
I am very frustrated with this problem and the Unity3D community isn't very helpful because no one there is answering my question. I have done a ton of searching to find what the problem could be, but I didn't succeed. I install Qualcomm Vuforia 1.5 and Unity3D 1.5.0.f. I use the Unity extension. I imported their demo app called vuforia-imagetargets-android-1-5-10.unitypackage, put their wood chips image target on the scene, their AR camera, and added a box object on top of the image target. Then I built it and sent to my Samsung Galaxy tablet. However, when I open the app on the tablet and point the tablet to the image target, nothing shows up - the box isn't there. As if I didn't add any objects to the scene. I just see what the device camera sees.
Has anybody experienced this before? Do you have any ideas what could be wrong? No one online seems to be complaining about it.
Thank you!
Make sure you have your ImageTarget dataset activated and loaded for your ARCamera (in the inspector, under Data Set Load Behaviour) and that the checkbox next to the Camera subheading in the inspector is ticked.
Also ensure that the cube (or other 3d object) is a child of ImageTarget in the hierarchy, and that your ImageTarget object has it's "Image Target Behaviour" set to the intended image.
You may also have to point your ARCamera in such a way that your scene is not visible to it.
Okay. I got the solution. I asked on Qualcomm's forum and one gentleman was nice enough to explain to me that I missed setting up Data Set Load Behaviour in Unity's AR camera. I had to active the image target data set and load the corresponding image target. Once I set these two things up, built and deployed, all worked well.
Good luck!
Description:
My OpenGL game runs fine on phones. However, after a couple of seconds of running on a tablet the 3D rendering goes all green. The 2D overlays (gl) are mostly fine.
This might be triggered by rotation, I can't be sure; no access to a tablet.
A user kindly recording it happening, which I have posted online:
http://www.youtube.com/watch?v=DRfDM673TRA
Questions:
Has anyone seen this before, or know of a possible cause/cure?
Also, can anyone confirm this is is still happening? (BB Rally Lite is free).
Other info:
The game is locked into landscape mode so I wouldn't expect it to do anything on rotation.
Update:
This was a bug in my code.
Tablets have a different default orientation,
which was triggering conditional (bugged) code that never got run on a phone.
The green screen was a result of the bug causing the model's matrix to contain nan (or inf, I can't recall).
If you suffer from a green screen I suggest you start by looking at your matrices.