Forum rules - please read before posting.

Disable Interaction Icon text when interaction is disabled

edited December 2017 in Technical Q&A
I have a question, is it possible to disable the interaction icon text if the interaction is disabled. 

To elaborate more, for my interaction buttons, I have Use, Lookat and Talk. They are not all active at the same time.

My question, If Talk interaction is active, I want to disable the text for Use and Lookat.

Comments

  • There's two ways to show an interaction's label - either in the Interaction element when the Display type is set to either Icon And Text or Text Only, and in the Hotspot label.

    If you're talking about the icon's text, you could do it if your Menu's Source is Unity Ui Prefab - that way you could dynamically show/hide the Text component based on whether or not its associated Button is active.  But as this is a visual issue, it would help to see a screenshot showing what you mean.
  • How exactly do I go about doing it? I have it set to icon and text only in the interaction menu using unity ui prefab. 

    An example is below: 

    image
    image
    Only the look interaction is available and the text is showing. It makes the UI look less cluttered. 

    Is it possible to do that at all?
  • Could you share an image of what you currently have as well?  I need to see a clear difference between what you have vs what you want.  Your original question was just about hiding the text, but now it seems like you want the actual Interaction element to be hidden.

    The Interaction menu by default should only show icons that can be used with the Hotspot it's open for - see the 2D Demo.

    However, when using Unity UI, you need to set the correct When invisible property for your elements in the Menu Manager.  This shot shows your Use icon is set to Disable Interactivity - try changing it to Disable Object instead.
  • This is what I  have so far. As you see, all text is showing up. In this interaction, I only want lookAt to show.imageimage



    image
  • edited December 2017
    So what affect did changing the "When visible" field have?  Since it's Unity UI, you can still animate e.g. the colour of your labels to have zero alpha when the button is disabled - that's all done though the UI component Inspectors.
  • I animated the unity ui alpha text to not show when the button animator state is disabled. However when I set when visible to disable object, it completely disables the object from appearing. This is when I'm using icon and text.

    When I set when visible to disable intractability,  it works but it glitches. All text is off. I've tried all options from icon and text, to text only and icon only. All text just disappears even on hotspots that have available interactions.
  • The "Disable object" option sounds like it's working as intended.  I'll try to recreate your issue with the "Disable interactibility" option - could you share a screenshot of one of the Interaction element's Unity UI Button Inspectors?
  • I'm using Unity UI in scene for my interaction menu GUI. 



    image




    One other thing I noticed, when I set when visible to disable interactibility, if the hotspot detects an item with only a look at interaction, the lookat text will show but the other ones wont show; that's good. 

    However when I go to another object that has the lookat and use interaction available, the look at will show but the use interaction will be disabled.

    It's like it's not updating or something.


  • Thank you, but I was asking for the Button's Inspector so that I can recreate your method of animating the interactibility colours.

    It might be easier to just create a .unitypackage of your Managers, your UI asset files (with UI graphic files), player prefab, and a test scene.  If you can prepare one, by all means PM it to me and I'll see what's wrong.

    One thing to check, though: is each button set to animate just itself / its own Text component?  It sounds like they're referencing the wrong components.
  • I can't post the unitypackage yet, so i just took some more screens and ill explain how i animated it. I added the text color and animated the alpha to not display in the disabled animation. both buttons and text have the same animator.

    I hope you can decipher the screens below.



    image


    image

    image

    image

    image
    image


    image


    image



  • You can see in your Animation window shot that it's missing GameObjects referenced by the animation.  This is probably because your Text children all have different GameObject names, and the Animation system relies on object names for reference.

    Try giving them all the same name "Text" and redo the animations.  An official Unity tutorial on setting up animated UI states can be found here.  But if this is the source of the issue, then this is related to Unity UI and not AC.  You can check that AC is not causing this by setting the "Transition" field to e.g. "Color Swap" and seeing if the colors are properly changed appropriately.  If so, this won't be something you set within AC but will be all down to your UI objects/hierarchy.

    I don't think you need an Animator on your Text children either - only the one on the Button will be manipulated.
  • Ive tried multiple things, it's not working properly. 

    The issue is, if I have 2 interactions. 1 that has only Use interaction available and another one that has both the Use and Talk to interaction available.
     
    the alpha value of the one with use and talk to interaction, the talk to interaction button alpha doesn't update. The use one updates because both hotspots have use interaction.

    I've tried using canvas groups and updating the button alpha but it doesnt work.
  • edited December 2017
    In fact, this is actually a glitch ive noticed with unity ui in scene and also unity ui prefab. The alpha value doesn't update when moving one hotspots interaction to another.
  • edited December 2017
    And what if you switch back to Adventure Creator source mode?

    My offer to receieve the UI package still stands.

    You could also consider disabling the object and having a "inactive" graphic underneath it that then shows then the regular one is disabled.
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.