Jump to content

"Set Time of Day" Action using Game Creator


rotem adler
 Share

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
 Share

  • Tell a friend

    Love Unity 3D World & Game Creation Tools - Canopy - Procedural Worlds? Tell a friend!
  • Interesting Articles

    1. 8

      Errors from Gaia 2021 after updating to Unity 2021.3.2 LTS

    2. 7

      Problems with latest Gaia Update

    3. 7

      Problems with latest Gaia Update

    4. 0

      Ambient sounds issues

    5. 7

      Scene Optimizer

×
×
  • Create New...