Jump to content

"Set Time of Day" Action using Game Creator


rotem adler
Go to solution Solved by Josh,

Recommended Posts

Hey guys !

I want to enable switching between Day / Night (or set Time Of Day to a specific hour) using a Game Creator action. How can I set this up ?

Many thanks in advance for any help !

Link to comment
Share on other sites

You would need to create a default GC action, get a reference to the Gaia gameobject where the Date and Time settings are and on this reference use the Gaia SetTimeOfDay method (or something similar like that, I don’t know the method name). 

  • Like 1
Link to comment
Share on other sites

There's plenty of code online for doing time of day stuff that you could wrangle and as @MiTschMR says then it's a matter of connecting a couple GC vars to use and throwing them into those Gaia commands.

It's more basic in GC1 than GC2 for sure, even a copypaste n00b like me could probably do it 😄

Link to comment
Share on other sites

  • Solution

@rotem adler If you are using the PW Sky system then yes like @Ugur Tuna mentioned the Gaia API has some functions to set these.

int hour = 5;
float minute = 40f;
Gaia.GaiaAPI.SetTimeOfDayHour(hour);
Gaia.GaiaAPI.SetTimeOfDayMinute(minute);

Hour is an int and minute is a float

You can also set the data block and tweak the other settings if you need to.
Here is an example of that.

Gaia.GaiaTimeOfDay tod = Gaia.GaiaAPI.GetTimeOfDaySettings();
tod.m_todHour = 5;
tod.m_todMinutes = 40f;
Gaia.GaiaAPI.SetTimeOfDaySettings(tod);

The GaiaTimeOfDay has the following settings: (bool)Enabled/(int)Hour/(float)Minute/(float)TimeScale. The starting time of day is no longer in use and will be removed.

Hope this helps in setting the time of day

  • Like 1
Link to comment
Share on other sites

On 1/11/2022 at 12:44 PM, rotem adler said:

Hey guys !

I want to enable switching between Day / Night (or set Time Of Day to a specific hour) using a Game Creator action. How can I set this up ?

Many thanks in advance for any help !

I have uploaded an action to the Game Creator hub: https://hub.gamecreator.one/content/item/S6NINgpwwteF2p6j7RuZ

Please see if that works for you. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...