Skip to content

TimeProviderCutscene component has wrong Start() method name #1173

@TinyNiklas

Description

@TinyNiklas

Is there an existing issue for this?

  • I have searched the existing issues.

Have you checked the documentation to resolve your problem?

  • I have read the linked documentation and could not resolve my issue.

Current Behavior

If you also encounter this issue, I have found a fix that you can find in the "Expected behaviour" below:

The problem:
The TimeProviderCutscene.cs component which is used to control the simulation time of an ocean renderer via a Unity timeline does not work in a build.

This is because the Start method which is supposed to initialize the component is actually misspelled as "OnStart()", which is not a valid MonoBehaviour call and thus doesn't get executed when starting the game.

This is only a problem in a build though because there's a fallback check in the Update() call that also triggers the initialization process - but that part is inside an #if UNITY_EDITOR condition. So basically the initialization only gets triggered by the Update() method when using the Editor but in a build the initialization method never gets executed.

Expected Behavior

The TimeProviderCutscene component should affect the simulation time of a referenced ocean in a build, not just in editor.

The solution:
There's 2 things you can do:
a) Change the "OnStart()" method name to "Start()" which is arguably the safer option (and probably what was intended anyway).
b) Remove the #if UNITY_EDITOR condition from the update method. This should technically work as well but is definitely less desirable because you'll waste a lot of precious resources trying to initialize the component on every frame which might impact performance.

This is an easy fix, would be nice if you updated the asset accordingly. Thanks!

Steps To Reproduce

  1. Create an Ocean Renderer component
  2. Create a PlayableDirector component
  3. Create a TimeProviderCutscene component
  4. Reference the Ocean Renderer and the PlayableDirector in the TimeProviderCutscene component
  5. While in editor the TimeProviderCutscene component will affect the simulation time of the Ocean Renderer when navigating the timeline. In a build of the game the TimeProviderCutscene won't affect the simulation time of the Ocean Renderer though.

Unity Version

6000.0.47f1

Crest Version

4.19

Render Pipeline

Universal

Editor or Standalone

Standalone

Environment

- OS: Windows 11
- GPU: NVIDIA GeForce RTX 4060 Laptop GPU
- Graphics API: Unknown
- Target Platform: Windows

Anything else?

tl;dr:
The TimeProviderCutscene component's start method needs to be called "Start()" instead of "OnStart()".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions