Unity 2017: Canvas Not Rendering on Build - android

I've been using unity for quite some time. But I downloaded the latest version 2017.2.1f1 and started a new project. Everything is running fine in the game and scene view. Playing the game in the editor is working fine as well. However, when I build it to my android device (API Level 19). The Canvas and all of the UI elements are not visible. The Render Mode for the Canvas is set to Screen Space Camera and UI Scale is Scale with screen size. I tried looking around but I'm not able to find a fix that works in my case scenario. Any help will be much appreciated.
Please note that I'm working on a 2D game so the environment is set to 2D, if that helps in any way

Let's say you are porting your project from an older version of unity. OR Unity crashed while you were actually building the project. Under these scenarios. Unity might not include all the required shaders and in some cases Classes for some reason. However there is a really easy work-around over this. Just follow the steps as listed:
Close Unity
Browse to the folder/directory of your project.
Delete the Project Settings Folder. (It might delete some editor settings but as far as your project is concerned nothing is going to change.)
Open Unity again and open your Project.
Unity will rebuild the project and the error will be fixed.

Related

Vuforia VUMark working in Editor but not on device

We've recently implemented Vuforia using Vumarkers and are about to purchase a license. We've tested with the 'tuxedo' test Vumarker from Vuforia. Both in the Editor and Android worked just fine.
As a final step in our development process, we've made our own Vumarker using the Illustrator template. Everything works fine, the marker was validated, uploaded to their website and we've generated some test markers. Everything works fine in the Unity Editor.
But when we build our project on any device no markers are detected at all and no errors are thrown. Does anyone else experience this problem? We've tested in all light environments and marker sizes to make sure it's not a camera problem.
We've used the following versions
Unity 2017.3.0f3 Windows 64bit
Vuforia 7.0.36
Android 7.x
If you have indeed successfully created vumark instances and downloaded the dataset, and you are sure nothing is detected and no errors are thrown, and if you are using the exact code from the sample and only replaced the dataset...
Then the first option that comes to mind is - did you load and activate the new dataset associated with the VuMarks?

Android game crashed after displaying unity's splash screen

I found this question on different forums but they didn't helped me to find solution of my issue. I had port unity(5.4) game on my android device (OS 4.4). When i opened the game it crashed after displaying unity's default splash screen. I wonder, it was working fine on unity's editor but didn't worked well on device.
Here is the logcat file link. Please let me know if i can provide any additional information that may help to track the issue. Many thanks.
Regards,
Ali
90% it's native plugins. Try to remove all your native android plugins. You can find them under Plugins/Android folder. You also need to remove all links or scripts that uses those plugins. Don't forget to make a back up. If your app won't crash, replace them with some others or connect with plugin development support.
I found the solution. I followed following steps.
Solution
Go to 'Player Settings' -> 'Other Settings'. Uncheck Auto
Graphic Api. Remove 'OpenGLES2' from list.
Test your game on better android device. In my case i tested on Samsung Glaxy S5.
If solution doesn't work
Remove all objects from scene. Port the project and test, if that
works, it means you need to remove unnecessary objects from scene
that need a lot of render power to load on mobile device.
Make sure your Android SDK is uptodated a long with JDK.
Just make sure Virtual Reality support is unchecked

Game Object working in scene and game view, but completely invisible in Android build

I have thoroughly searched on the web but I couldn't find anyone with my same problem.
I'm working on a 3D game for Android using Unity. Everything works fine within the editor and on the Unity Remote app, but when I build the project, install it on my smartphone and start it... I can't see a game object.
A screen of the project:
As you can see, the sword is active and visible in the editor, but once I start the actual build I get this:
I can't understand what's wrong, could someone kindly help me? Many thanks.
Does the material of the sword have the standart shader?
If so try one of the mobile ones.
Another idea would be to upgrade to one of the newer p versions of Unity.
Since the sword has a rigidbody, have you enabled gravity and somehow disabled collision and its falling through the ground?
Other than that, it could be a shader problem.
Problem solved. I upgraded from Unity 5.3.2 to 5.3.4, re-built the project and everything works like a charm now.
Sometimes Unity can be... strange.

Using Project Tango Unity example projects

I have tried to use the Project Tango unity examples found here; https://github.com/googlesamples/tango-examples-unity with no success.
I have never used Unity before, and have successfully completed the Codelab: Motion Tracking example fromt he developer resources: https://developers.google.com/project-tango/apis/unity/unity-codelab-motion-tracking.
I downloaded the example files mentioned at the top, open one of the projects (tried several, all have the same problem). Once the project is open, I open the scene that come with it, I go to Build Settings, change platform to Android, change the Bundle Identifier and set the Minimum API Level to Jelly Bean 17 and finally click "Build and Run".
Now it starts to build the project, everything goes fine and the Unity logo shows up on the Tango. And that's it, the Unity logo shows up, no error messages on the computer, but nothing more happens. The program stalls at the Unity logo.
Am I missing some crucial step to get the example projects to actually run?
Thanks in advance!
The example code is Unity 5 based project, so please use the 5.x version of Unity to open it. If you use Unity 4.x version, the scene won't be opened up properly.
However, the code lab is based on Unity 4.6 and it is independent from our sample code. I understand this is a little bit confusing now, we are working on make sure the version are unified.
In short, I would suggest you open our example code with Unity 5.x version. You will be able to run it without a problem.
It was blank empty scene build. thats why after the unity logo it didn't load any scene or do anything.
You need to go to Unity Build Setting and drag and drop all the scenes from the examples folder in it.
Once you have all the scenes. Make sure that AreaDescriptionManagement is on the top of the list.
That is the only step missing from you.
Now, build and run. Everything should be fine.

Exact same code - apk built in Android Studio is laggy and slow, same built in Eclipse fast and not laggy?

So, I have run into a peculiar problem.
I have an Android app, originally developed in Eclipse, and then I migrated to Android Studio as I think its a much better IDE to work with.
So, I had some issues with a horizontal pager that was very slow, laggy and hard to use, and I thought there must be something wrong with the code. However, if another dev builds the same project/code (XML-files, java-files and SDK/references), the pager is not laggy at all - all the problems with the pager goes away completely.
The only difference is that the same code is built in Eclipse instead of Android Studio.
I find that basic behaviour is changed too:
When I build the app in Android Studio, the horizontal pager works like this:
If I start the drag movement, and I "catch the drag", any movement in vertical direction will immediately release/drop the "drag state". This makes it very hard to move the page in any direction, because you rarely move your finger EXACTLY horizontal.
If the same thing is built with Eclipse, it works like this:
When the "drag" is in effect, it doesn't matter if I move my finger vertical, that movement is ignored. It is "locked in" to the drag effect, and thus makes it a lot easier to switch page. This is the behavious I want of course.
The pager used is like:
CirclePageIndicator extends View implements PageIndicator
and code for that one can be found here.
I have tried to figure out if there is a difference in SDK or target platform or something, but I can't find any relevant differences in build paths, SDKs, target platforms etc.
So, this is some images from Eclipse/dev setup:
And this is from my Android Studio computer:
Does anyone have any ideas here?
Make sure that all the support libraries are the same in both build systems, you can also check to see if there's a difference in size for the 2 APKs.
As #Sean pointed out, the difference in Android Support Library is probably the cause of the problem.
I had the same problem but with a canvas after migrating from Eclipse:
Refreshing a canvas in the APK generated with Eclipse worked at speed of light, but after migrating to Android Studio and with the same exact code the APK was very slow refreshing the canvas.
The solution i found:
In Android Studio, when starting the import process this dialog appears:
Dialog Screenshot
In order to avoid changing the libraries and making the app slow, it is only necessary to uncheck the checkboxes 'replace dependencies' and 'replace librery sources'
Also do not enable (or disable) instant run
That worked for me and the app canvas is now fast in Android Studio too

Categories

Resources