Forum rules - please read before posting.

Change Color of Empty Slots in SavesList

edited May 1 in Technical Q&A

Hi all,

Hope you are doing well!

I was following this tutorial a while ago so players can set custom names for their saves: https://adventurecreator.org/tutorials/custom-save-game-labels

I tried using HTML color tags in the default text to differentiate empty slots vs. saves with colors in them, but it looks like the color tags are being placed into the name when I'm clicking on it.

Is there any way I can prevent this behavior, or is there another way I can color the text for the empty slots vs. filled slots a separate color?
Here is a video of the initial value, the variable set, and the behavior I am encountering: https://drive.google.com/file/d/1I1Wzei5jYcsp-tOxNVEMR3MDtodfN4ZY/view?usp=drive_link

Any help is appreciated, thank you!

Comments

  • edited May 1

    I should mention -- when I enter a save name, it is fine at first (it shows up as "New Save", but the moment I click on it or hit backspace to change the name -- it becomes "<color="#F0F8F8"> New Save < / color>" -- which is what I set the "New Save" text to under the SavesList element.

    This is all under the same repo from this issue, if that would help!: https://adventurecreator.org/forum/discussion/14845/endcutscene-button-causes-menu-to-never-turn-off-when-scene-switches/p1 :)

  • Leave the tags out of the labels/variables themselves - the save is best recorded without any tags.

    Is this a Unity UI-based Menu? Best to attach a custom script to each of the slots instead, which checks if the slot it represents has a valid save.

    This can be done with the DoesSaveExist function. Something along these lines:

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    
    public class RecolorSave : MonoBehaviour
    {
    
        public int slotIndex;
        public Text textBox;
    
        void OnEnable ()
        {
            bool hasSave = SaveSystem.DoesSaveExist (slotIndex, 0, false);
            textBox.color = hasSave ? Color.cyan : Color.white;
        }
    
    }
    
  • edited May 1

    @ChrisIceBox It's a native adventure-creator menu -- is it possible to do the same here somehow?

  • Video above shows variables / placeholders :)

  • It's a native adventure-creator menu -- is it possible to do the same here somehow?

    I'm afraid not. For styling tweaks that involve scripting or go beyond the properties provided in the Menu Manager, Unity UI is necessary.

  • No worries -- thanks for the heads up!

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.