Forum rules - please read before posting.

drop down menu stops

edited April 2016 in Technical Q&A
Hey,

Strange one here, and its about to break me. 

if I put my options menu in scene to begin with, it works as it should. (srop down, via own code to manipulate the y of the RectTransform of the button)

if I make it show during game play, as the it stops working.

Code still firing, done tests, but the y value will does change at all. I can still change the value manually in the editor, just wont do it through the code i got, well not when AC seems to put the prefabs in scene of the menus.

video below showing the issue:

https://youtu.be/3UDrgaiaJ7I

Comments

  • Is the element linked to AC's Menu Manager?  Unlink if unless it has to be.  Without knowing your code it's difficult to give much more advice, but you may want to consider animating your UI instead.
  • the resoluton is not linked to AC menu manager. And the script is very simple.


    public class DropDownMenu : MonoBehaviour, IPointerClickHandler
    {
        public RectTransform container;
        public bool isOpen = false;

    // Use this for initialization
    void Awake ()
        {
            container = transform.FindChild("DDContainer").GetComponent<RectTransform>();

            isOpen = false;
        }
    // Update is called once per frame
    void Update ()
        {
            Vector3 scale = new Vector3(0, 0, 0);

            if (isOpen == true)
            {
                print("true");
                scale = container.localScale;
                scale.y = Mathf.Lerp(scale.y, 1, (Time.deltaTime * 12));
                container.localScale = scale;
            }
            else
            {
                print("false");
                scale = container.localScale;
                scale.y = Mathf.Lerp(scale.y, 0, (Time.deltaTime * 12));
                container.localScale = scale;
            }
            print(scale);
              
        }

        public void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
        {
            if (isOpen == false)
            {
                isOpen = true;
            }
            else
            {
                isOpen = false;
            }
        }
    }
  • Can't see why there'd be a conflict - AC doesn't control the scale of elements, even the ones that are linked.  But I'll try it out myself and see if I turn up anything.
  • thanks

    like video shows, its ok when in scene to begin with.

    but when linked through AC menu system, unable to change the y value :/

    a little fustrating XD
  • I found out why XD

    The menu was pause game when active.

    Bit of a pain tho, i want to use both pause game when active, and use that anim XD

    time to rethink
  • When paused, Unity's Time.timeScale is set to zero - so Update() calls won't work.  You should be find with FixedUpdate(), though.
  • Same issue with FixedUpdate

    Its ok i will have it not pause, and control the game more manually.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.