Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Why is my panel starting on wrong location

Discussion in 'UGUI & TextMesh Pro' started by pKallv, Oct 5, 2014.

  1. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,125
    I have a menu system looking like this in it's initial stage:

    When pressing the icon in the lower left corner i want to animate/move the blue menu into the scene. That works well except the fact that when i start the game the (blue) menu is displayed on the scene a bit below this position and then automatically/direct moves up to the position on the picture. I want it to start with the menu outside of the scene.

    The Y-pos in the picture above is 15 and when the (blue) menu is on the scene it is -15.

    In the Animation view i have the following:

    position = 15
    position -15

    I use the following code to control the process:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public classUI_Engine : MonoBehaviour {
    6.  
    7.    public Animator shufflePanel;
    8.    public static bool panelIsOut = false;
    9.  
    10.    public void OpenShufflePanel() {
    11.  
    12.    if (panelIsOut == false) {
    13.       shufflePanel.SetBool ("isHidden", true);
    14.       panelIsOut = true;
    15.    }
    16.    else {
    17.       shufflePanel.SetBool ("isHidden", false);
    18.       panelIsOut = false;
    19.    }
    20. }
    21.  
    22. }

    The problem is that the when starting the app the panel is out, position -15, and immediately moves out of the scene, position 15. However, the panel is placed on position 15 when starting, but is started at -15.

    I do not understand why this is happening?
     
  2. PeteD

    PeteD

    Joined:
    Jul 30, 2013
    Posts:
    71
    What have you set up as your animation?

    By this I mean what have you set up as the flags for transitioning from one state to the next and what are the holding states etc. etc. in the animator window.