Forum rules - please read before posting.

Objectives Label visible after completion

I love the new Objectives feature, it's perfect for keeping the player on track when you have multiple threads going!

I've set up a Unity UI prefab to display the Objectives with buttons updating a Label with the Selected Object/Description. This works well, I can click on an objective button and read the description. However, when an objective state is set to Completed, its description is still showing in the Label until you select another Objective (if one's available).

I want only the active Objectives visible at any time, and Active Only is enabled in the ObjectivesBox. That works great for the buttons, but in my case the label is stuck on the previous description.

Is there a way to clear the label when an objective is completed, or am I doing it wrong? I guess it would be possible to add a custom script to the UI prefab to clear the label text when it's enabled, perhaps?

Latest AC/Unity 2018.4.

Comments

  • Sounds quite specific to the way you've set things up. So that I can attempt a recreation, I'll need to see screens of exactly what options you've set.

  • Thanks, here are some screens of my setup:

    ObjectivesBox
    https://imgur.com/a/7ySqlVa

    Label button (poorly named, should've been Description button):
    https://imgur.com/a/a30YXIk

    Back Button:
    https://imgur.com/a/FnfjEA1

    Hierarchy and visual setup:
    https://imgur.com/a/oSb2loe

    As of now, it appears that the description is always filled with the last selected objective when returning to this menu. I'm pretty sure I could find a way to work around this somehow, but if you know what may be causing it that would be helpful :)

  • edited April 2020

    The issue is that the Label that shows the description is separate to the InventoryBox that lists "only active" Objectives. The label will display whatever's selected, regardless of whether it's active or not.

    The DeselectObjective() function can be used to de-select the objective that gets shown in the Description box.

    If you wanted to run this when an Objective is updated, as you mentioned, you could hook into the OnObjectiveUpdate event, e.g:

    using UnityEngine;
    using AC;
    
    public class DisableUpdatedObjective : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnObjectiveUpdate += OnObjectiveUpdate; }
        private void OnDisable () { EventManager.OnObjectiveUpdate -= OnObjectiveUpdate; }
    
        private void OnObjectiveUpdate (Objective objective, ObjectiveState state)
        {
            if (KickStarter.runtimeObjectives.SelectedObjective == objective)
            {
                KickStarter.runtimeObjectives.DeselectObjective ();
            }
        }
    
    }
    
  • Cheers, I tried just adding a custom script to the menu with this function:

    private void OnEnable() { KickStarter.runtimeObjectives.DeselectObjective(); }

    And that seems to be working for me. Thanks again for the help!

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.