Search Unity

Easy UI Motion : Animate your interfaces for Unity UI

Discussion in 'Assets and Asset Store' started by Hedgehog-Team, Jan 27, 2015.

  1. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    Hi I just bought your asset, and I have to say it works great as I can just set it up in minutes :)

    I was wondering is it possible for you to add corner anchors for the To/From Move Effect in the inspector?

    Thanks.
     
  2. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    I found something weird.

    Sometimes the animation wouldn't play at all.
    I have this scene setup of many different panels. By pressing next/prev button respectively, I would like to scroll through the panels. It kinda works but in certain condition like when I press the buttons too fast before the animation has finished playing, the Open/Close will fail to play.

    The code I used:

    Code (CSharp):
    1. IEnumerator INextPage()
    2.     {
    3.         if(currentPage < PagePanel.Length - 1)
    4.         {
    5.             foreach(Button child in buttons)
    6.             {
    7.                 child.interactable = false;
    8.             }
    9.  
    10.             PageGO[currentPage].gameObject.SetActive(false);
    11.            
    12.             foreach(Transform child in PagePanel[currentPage])
    13.             {
    14.                 EMOpenCloseMotion tween = child.GetComponent<EMOpenCloseMotion>();
    15.                
    16.                 if(tween != null)
    17.                 {
    18.                     tween.CancelInvoke();
    19.                     tween.Close();
    20.                 }
    21.             }
    22.            
    23. //            yield return new WaitForSeconds(delay);
    24.             PagePanel[currentPage].gameObject.SetActive(false);
    25.            
    26.             PagePanel[currentPage + 1].gameObject.SetActive(true);
    27.            
    28.             foreach(Transform child in PagePanel[currentPage + 1])
    29.             {
    30.                 EMOpenCloseMotion tween = child.GetComponent<EMOpenCloseMotion>();
    31.                
    32.                 if(tween != null)
    33.                 {
    34.                     tween.Open();
    35.                 }
    36.             }
    37.            
    38.             PageGO[currentPage + 1].gameObject.SetActive(true);
    39.  
    40.             yield return new WaitForSeconds(delay);
    41.             foreach(Button child in buttons)
    42.             {
    43.                 child.interactable = true;
    44.             }
    45.  
    46.             currentPage++;
    47.         }
    48.     }
    I thought that by delaying the intractability of the buttons it would solve the problem, but it still happens.
     
  3. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,154
    Hi,

    The opening can be requested only when the state is "close" .This was done in case a loop would call several times the opening so that the overture is played once.So you can request the closure during opening, but you can not ask the opening during closure. Your problem may be there.

    I'll see if I can add a method that forces the opening whatever status

    For your request "corner" it is a good idea, I'll see what I can do. But in the meantime, you can use the option "User Defined", which allows you to place yourself the opening or closing point.

    upload_2015-10-6_11-16-49.png

    1- Select the option User Defined
    2- Click on Record button
    3- Place your object in the vscene (you have to set the anchor to)
    4. Click on Stop button recod
     
    Last edited: Oct 6, 2015
  4. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    For the opening/closing problem, I solved it by just doing something like this :

    Code (CSharp):
    1. tween.SetStateToClose();
    2. tween.Open();
    3.  
    4. // and vice versa
    I will try the record method for the corners as you suggested.

    One more thing, I also noticed that the scaling/rotating of my buttons starts from the corner and not from its centre. Is this normal? Or should I set a pivot somewhere?

    Thanks!
     
  5. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,154
    Hi,

    All actions are based on the pivot of the UI element. Check if your pivot is correctly placed.
    upload_2015-10-6_11-45-55.png

    The blue circle is the pivot, just drag it to move it
     
  6. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    299
    Hi

    I've got this bug where the EMMotionManager stays after I exit play mode, and it stacks up
    I guess it is safe to delete?
     

    Attached Files:

  7. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,154
    Hi,

    If you have this, it's mean that you create UIElement at destroy time, and the EMMotionManager is created another time.

    To avoid this, the best way is to create the EMMotionManager in design time,to avoid its dynamic creation :
    1- Create an empty gameobject
    2- Drag 'n Drop the script EMMotionManager
     
  8. hytka81

    hytka81

    Joined:
    Jun 22, 2013
    Posts:
    26
    Hi!

    My UI has all window's set to SetActive(false) at startup (or in the editor). Is there any way to do SetActive(true) just before Open(), maybe inside On Open Start, since now animation does not play because the game object is not active.

    UI is not active since I prefer not to show all UI window's in the editor while doing any modifications to the scene. Or is there some better way of achieving this? Everything is ok if I leave game objects active...

    Edit: If I set the game object in question to active state just before calling EMMotionManager.Open("MyOpenClose"); the game object is active => animation plays but for some reasong the CanvasGroup's alpha is set to 0 on first play... then after close when I play open again the canvas group has alpha 1 and window is shown properly.

    Edit2: I managed to get it to work somehow if I call "EMOpenCloseMotion.showUIElement" in OnOpenEnd.

    Thanks in advance,

    Kalle
     
    Last edited: Oct 26, 2015
  9. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,154
    Hi,

    When gameobject is disabled, you can not activate from script that manages itself, we must do it from the outside.

    So you should therefore controlling for yourself depending on the initial state of your Ui element. As you have done.
     
  10. hytka81

    hytka81

    Joined:
    Jun 22, 2013
    Posts:
    26
    Thanks for the reply!

    Yes, I think that part is ok now but for some reason it seems that sometimes when animation plays for the first time the UI is not fully visible (some parts might be invisible, for example UI Text). I'm going to test this more later today but if I use transform.SetAsLastSibling() for the panel it seems to fix this problem at least to some extent so it might be issue with orders.

    Edit: Visibility problem is not occurring in the Unity Editor but on Android devices (tested with Galaxy Tab 4 and Galaxy S6 Edge).

    -Kalle
     
  11. hytka81

    hytka81

    Joined:
    Jun 22, 2013
    Posts:
    26
    This visibility problem was fixed by making the size of the Text components little bit bigger (not the size of the font but the actual component). After that UI texts are properly displayed. It was just weird that before using Easy UI motion text were working fine with their previous sizes but now that I know about this it's not a problem.

    -Kalle
     
  12. hytka81

    hytka81

    Joined:
    Jun 22, 2013
    Posts:
    26
    Hello again!

    Is there any way to make these motions to work with Time.timeScale = 0? I would prefer pausing the game using timeScale when user is in the menus so this would be nice if it's possible.

    EDIT: Strange that EM Open Close Motion seems to work also when timeScale == 0. I'm probably doing something wrong here. <-- actually first OpenClose does not work if timeScale = 0.

    EDIT2: Nevermind, I thought it was not working with timeScale = 0 because I didn't see anything and it's this same problem that CanvasGroup alpha = 0 on first play and UI comes visible only after calling EMOpenCloseMotion.showUIElement() on OpenEnd (does not work in OpenStart for example).

    EDIT3: Sorry, this post is most likely quite confusing, sorry for that, but this is my latest observation: with Time.timeScale = 0 the first animation Open does not work (triggered on Start()). Close will work after first Open even if timeScale is 0. If I use timeScale = 1 to begin with the first Open animation also works.

    Br,

    Kalle
     
    Last edited: Oct 28, 2015
  13. g__b

    g__b

    Joined:
    Sep 17, 2014
    Posts:
    20
    Hello,
    is it possible to set the User Defined Position of a motion at runtime? I cannot find any clue in the docs.
    Or does it just works with predefined values in the editor? I'd like to swap UI Images in a grid puzzle game.
    Thanks!
     
  14. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,587
    I'm jumping into a project that uses EasyUIMotion, but I'm running into bugs I don't understand that appear to be in the EasyUIMotion code...

    And poking in the code, I see that EMOpenCloseMotion.On_EndMotion expects a string "id" parameter. Poking around in EMEasing.cs, I see it's using SendMessage a lot (ick), but the value parameter in many cases appears to be an EMEasingCallback object rather than a string.

    Any idea what's gone wrong here?
     
  15. khrysller

    khrysller

    Joined:
    Mar 14, 2019
    Posts:
    22
    Is it possbile to show an animation when a scene is loaded, in Start? I did this:

    Code (CSharp):
    1.     public void Start()
    2.     {
    3.         void OpenAPI(){
    4.             EMMotionManager.Open("HedgehogOpenClose");
    5.         }
    6.     }
    But it is not working

    Thanks


    OK, got it

    Code (CSharp):
    1.     void Start()
    2.     {
    3.         EMMotionManager.PlayMotion("HedgehogOpenClose");
    4.     }
     
    Last edited: Jun 14, 2019
  16. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    65
    Hi,
    Still supporting your wonderful asset ? Your website is dead..
     
unityunity