- Home /
Modern UI 4.6 with Animations crashes on Android
Hi all!
I've been lurking through all Unity forums since I began working with it and usually try to find solutions before asking a question. After several days of searching I'm still stuck, hence this question.
Backstory: Relatively new to Unity and definitely noob in programming. Installed the new 4.6 version to tryout the new UI features.
What I want to achieve: Sliding Panel with Buttons from Off-screen to on-screen (and vice-versa).
My Approach:
Create Panel with buttons (all in Canvas)
Create animation for sliding in the panel
Script animation
Use Button in Panel to change boolean for animation
Problems:
In Editor: None
On Nexus 7 2013 Android L: none
On Nexus 4 Android L: app crashes after starting animation.
Here is my setup so far:
I have 2 states in the animator, one animates up, the 2nd one is just reversed (-1). Conditions for the animations:
Show > Hide : bool showMenu = true
Hide > Show : bool showMenu = false
Here's the script i use:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class UIScript : MonoBehaviour {
public Animator _menu;
public GameObject panel;
public bool showMenu
{
set{_menu.SetBool("showMenu", value);}
}
void Start () {
_menu = panel.GetComponent<Animator>();
}
}
So yeah... works fine in the Editor and on the tablet. Crashes on phones.
Couldn't upload more pics. If additional info is required please say something and I'll add whatever is required.
I'm really new to animations in Unity but I did search the Interwebs and watched the Unity tuts, but I feel I'm missing something. Maybe someone here can lighten my path. Please :)
Have a great one!
Well, if you can reproduce this crash reliably in a $$anonymous$$imum example scene, it would be great if you could file a bug report including your project and logcat of the crash. $$anonymous$$eep in $$anonymous$$d to be specific in a bugreport since it works on some devices.
Yes, 100% repro rate. I would be reasured if someone could have a look at my project. I'm open to skype calls as soon as I get home from work. And before submitting a bug I need to test on more devices...
I'm trying to get your Android build version in every comment here :) After that, please submit a bug report.
Hey! I wrote my android version in the lower comments :) LRX21T
Also, I narrowed it down to the Animator part.
I opened a little project I had from a while ago and re-did the canvas setup. Same crashes as before. The difference is that I have (multiple) animations inside the scene, setup on some game objects, and they work just fine. Whenever I put an animation on a GUI element, the crash is back.
Automatic button animations do not crash the app, only custom ones do.
Re-did the whole canvas setup on a new project and no crashes. Re-did it again on a new new project, crash is back.
I'm on a slippery slope to the insane asylum :))
@tricsuletz thanks. Please submit a bug report with your $$anonymous$$imal project, we'll take a look.
Answer by revapps · Dec 10, 2014 at 01:30 PM
Update to Unity 4.6.1 and see what happens.
updated to 4.6.1. no luck...
[Edit]: Can't post another answer? ok.
Yes, the android version is the official stock one, no root, no nothing. $$anonymous$$aybe I'm missing something code-related..idk. Did I do good what I did there? ^
I would feel so sad if I'd had to go back to 4.5 and tweens...
[Edit2] : Build number LRX21T. Fresh factory reset.
Please share your build number as I mentioned in my answer.
@Yury Habets @tricsuletz One year later and the bug still seems to exist. I am on Unity 5.2.1 and testing on a Android 4.2.2 device. I also narrowed it down to the animator animating modern GUI elements. Forcing OpenGL ES 2.0 is not available in unity 5.1.2. and adding a 1x1 button did not help either
Is there any solution to this problem?
Answer by Yury-Habets · Dec 10, 2014 at 03:16 PM
This can be caused by using Lollipop. Is your Nexus 4 using an official L image or developer preview? What is the build number in the "About phone" menu?
Your answer
Follow this Question
Related Questions
Oculus Quest deadlock 0 Answers
Android game crash 2 Answers
Android Crashes on game load 1 Answer
Spritesheet animation shake/jitter/wobble problem on android. 1 Answer