Forum rules - please read before posting.

【bug?】Menu Elements with Layout Components Display Incorrectly when Enabled in Adventure Creator

I used Layout components to control my image, so that when the text size inside the image changes, the image can automatically adjust its width and height.
I configured this image and its text into a menu using Unity Prefab as the source, and set the image to disable the GameObject when invisible.
When I make the image visible via a Cutscene, the layout is incorrect at first. After repeatedly closing and reopening the menu, the layout gradually becomes correct.
I set up a control group: another text element with the same Layout components, but not configured into the menu. In this case, the image layout displays correctly.

unity version 2022.3.34
AC version 1.83

Comments

  • What element type are you connecting to the Image, and what are its properties?

    AC shouldn't be controlling the size/position of individual elements - only what they display and their enabled/interactable state.

    If you move your control group to the same UI prefab - so that the two are side-by-side - does that remain unaffected?

    Does your Canvas's root have an Auto-correct UI dimensions component on it? There was an issue recently that caused this to incrementally re-scale Menus each time they were turned on, but this should have been addressed in v1.83.0.

  • edited April 17

    Thank you @ChrisIceBox.

    Current Setup:

    I'm not using Auto-Correct UI
    UI Image Type: Image
    Graphic Type: Normal
    When Invisible: Disable Object
    Problem:
    When using Unity's in-scene menu:

    The layout displays correctly initially.
    But if I set an image to be invisible by default in the menu, I can't make it reappear later through menu settings.
    It seems disabling the GameObject initially prevents AC from re-enabling it.
    I checked the source code but couldn't pinpoint the reason.
    Feature Request:
    Could we add a new UI element type that's simply a RectTransform container?

    Purpose: Toggling its visibility would show/hide all nested content (text/images within layouts).
    Use Case: I group text/images under Layout components and want to control their visibility by enabling/disabling the parent GameObject directly.

  • A RectTransform container doesn't have a "visibility" property - only its GameObject enabled state. AC requires that UI object are initially enabled in the prefab for them to be mapped to the elements at runtime.

    The typical way around this situation would be to instead rely on animation - an Animator could either control its enabled state (or alpha value of a CanvasGroup) and rely on e.g. a Bool parameter to control transitions to show/hide it.

    AC's Object: Animate Action can then be used to control the bool's state - and, in turn, the visibility of the UI chain.

  • thank you ,that is good.

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.