0
Answered

Acces to system time and/or date

Pierre 8 months ago in Game Creator updated 8 months ago 7

Is it possible to get access to the time and date of the system ? So it could be possible to make a day / night action slmilar to the recent system time?

Unity version:
All
Game Creator version:
All

Answer

+2
Answer

ActionTime.cs

The script above works, but I could not use the variable number, it did not update so it could be a bug. But it did work using a Vector3

So with the action ActionTime you would set it to a global or local variable in your scene.

Then you would make a separate trigger and use On variable change. There you could add a condition to when 14,20,00 then at two twenty in the afternoon you would fire an action.

That is the best I could do as I am only still learning about c#

To use the action create first a trigger OnStart and then look for this action ActionTime

Maybe Marti willtake a look and find out why I could not use a number variable .

GOOD, I'M SATISFIED
Satisfaction mark by Pierre 8 months ago
+1

ActionSystemTime.cs

How is this?

Copy this script into your project and then in your action under general you will have System Time.

You can download the script directly under my name above.

I think this should be under System but time scale is under general too.

Then you could have condition on the saved variable if 12 then noon, if 24 then midnight and so on.

+1

sorry, that above is not going to work and save to the GC variables. I know why. I'll do it in the morning

Thank you for your help. Hope you can bring it to work. Would be also a nice addition for the game creator.

+2
Answer

ActionTime.cs

The script above works, but I could not use the variable number, it did not update so it could be a bug. But it did work using a Vector3

So with the action ActionTime you would set it to a global or local variable in your scene.

Then you would make a separate trigger and use On variable change. There you could add a condition to when 14,20,00 then at two twenty in the afternoon you would fire an action.

That is the best I could do as I am only still learning about c#

To use the action create first a trigger OnStart and then look for this action ActionTime

Maybe Marti willtake a look and find out why I could not use a number variable .

Thank you very much for your effort ! Sounds great. I will give it a try as soon as possible. Maybe an employee of Game Creator also can look into it and check the Variable Update Issue and resolve it.

Answered

Thank you so much for creating this Action EagleEyez! 10 points to you! :-)

Pierre, when a variable is updated, it doesn't automatically update everywhere. You need to use the "On Variable Change" Trigger and update each Text accordingly. Cheers!

+1

All right, Marti. Thank you for the answer. Hope the Action will be downloadable in the Hub, for other users as well. Really great work.  Cheers !