Forum rules - please read before posting.

Using AC objectives

edited October 2020 in Technical Q&A

We need to add objectives to our game. We saw such thing in AC but it's not clear how to tune them to our needs.
We don't need all goals to be seen at start but to add them at certain points of a gameplay. Also, we need that finished tasks could be marked.
Now AC allows to show all objectives at once or certain type of them.
What could you advice in this situation?

Here is the example. Tasks here add during gameplay.


  • Setting an InventoryBox element's Objectives to display to All will show all Objectives that are active, completed, or failed. Those that haven't been started will not be shown.

    You can begin an objective by using the Objective: Set state Action to mark it as Started. Only then will it be possible to display it in a Menu.

    For the example above, set it to All. This will list active and completed objectives.

    To then also display either a tick or question-mark icon, depending on its state, you just need a simple script to check the objective state.

    Make a Unity UI-based Menu to list your Objectives, and then attach a separate set of Image components in your UI's hierarchy - to show the desired icon.

    Then attach this script to each:

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    public class ObjectiveIcon : MonoBehaviour
        public int slot;
        public Sprite completed;
        public Sprite notCompleted;
        public Image image;
        void OnEnable ()
            ObjectiveInstance[] objectives = KickStarter.runtimeObjectives.GetObjectives ();
            if (slot >= 0 && slot < objectives.Length)
                if (objectives[slot].CurrentState.stateType == ObjectiveStateType.Complete)
                    image.sprite = completed;
                    image.sprite = notCompleted;

    Fill in the Inspector fields, setting the Slot value to 0 for the first-shown, 1 for the second, etc. When the Objectives are shown, the icon should then be set correctly depending on its completed state.

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.