Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GothicSky.mat): Changes during Editor.OnValidate() removed as the… #349

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

JaXt0r
Copy link
Contributor

@JaXt0r JaXt0r commented Apr 24, 2024

…y will be set at game startup without saving to .mat file directly.

Two major changes:

  1. I removed the OnValidate() function which calls SetShaderProperties() as this alters values inside GothicSky.mat before the game starts but should only reflect runtime changes. The SetShaderProperties() is also called during game startup which is:
    WorldCreator.CreateAsync() -> InitSky() -> Interpolate() -> InterpolateSky() -> SetShaderProperties() after world is loaded and before loading screne is gone.
  2. GothicSky was set directly on world.unity scene. Therefore we couldn't overwrite it. Now setting the value at runtime when world is fully loaded dynamically as a clone.

Tests showed the sky is fine at startup.

JaXt0r added 2 commits April 24, 2024 05:12
…y will be set at game startup without saving to .mat file directly.
…We set it now at runtime when Worlds are loaded. + Cloning the material to ensure changes aren't reflected in the actual .mat file.
Copy link
Contributor

@ThomasMountainborn ThomasMountainborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downside of removing OnValidate is that changing light colors in the inspector only takes place when the in-game clock moves forward, i.e. not when paused and not when loading the world in the editor. But that's not necessarily a big problem. We want the light color values to be driven by the sky manager anyway. So it's fine by me.

…ges as we cloned the Gothic sky material already.
@JaXt0r JaXt0r merged commit 4882ce7 into main Apr 25, 2024
@JaXt0r JaXt0r deleted the bugfix/sky-mat-change branch April 25, 2024 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gothic sky.mat instantiate at runtime to overcome local git changed
2 participants