Forum rules - please read before posting.

Save Custom Label with Date/Time

Hi everyone, I want to create a custom label for the save game with Name and Date/Time. For example: Living Room February 22, 2025

I tried Save: Save or Load update label with Global Variable but I can only get the Name Living Room. I don't know how I can get the Date/Time.

I also tried changing Time display in Settings manager to custom format [var:5] MMMM dd, yyyy but the save name is Save 1(Living Room February 22, 2025).

Is there any way I can get the Date/Time and maybe save it to a Global Variable?
Thanks a lot!

Comments

  • Just found a way to store the Date/Time to Global Variable. Is there a better way to do it?

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using AC;
    
    public class DateTimeToGlobalVariable : MonoBehaviour
    {
        public int variableID;       
    
        public void GetDateTime()
        {        
            string dateTime = System.DateTime.Now.ToString("MMM dd,yyyy HH:mm");
            GlobalVariables.GetVariable(variableID).TextValue = dateTime;
        }
    }
    
  • The "Time display" settings will only apply unless you override the label with a custom one. If you do override it, you'll need to incorporate the date into the custom label.

    The script above will store the date into a string - you can use Variable: Set to combine it with another string that includes your custom label text.

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.