Here is an example code of how to do that.
Please note, that you can (and for this case should), set a custom name for Groups and Tracks in their inspector, by selecting that group or track.
We are trying to disable the subtitles track in the way you said for our options system to enable or disable subtitles from our manager script, but there is a problem.
This line: var track = group.tracks.Find(t => t.name == trackName);
Is returning a clone of the track “Rendering Track(Clone)” instead of “Subtitles Track”, so it is not working as expected. In fact, the track is being enabled and disabled in the editor timeline, but if the subtitles are shown at least once, they will keep showing although we disable the track.
If we try to Find() a different track, like the FMOD one, we are getting the original and not a clone, as expected.
As a clarification, the clips in the Subtitles Track are Captions clips, and each one has parts of the text for the subtitles of the audio. The problem we’re seeing is that even if the track is enabled/disabled, it doesn’t seem to change what’s happening on the screen. If the track starts as disabled, the subtitles won’t show during the cutscene even if we enable the track in the middle, and vice-versa.
Do you know how we could achieve this, maybe in a different better way? We’d like to stick to this Captions clip, as it’s what serves us better at the moment (being able to have them separately from the audio clip, and we also have a custom Localized Captions that updates the text from our localization files).
Also, I’ve thought that a possible simple solution we could just enable/disable the Director GUI, but then I guess we lose the fade-in/out effect between clips.
Well, we’ve finally found a solution for what we wanted to do. In the end, we just set the “text” in the Captions clip to an empty string if our options for “show subtitles” is off, and revert it back if it’s on. With an empty string, the background box for the captions disappears too, so everything works as desired. 🙂
In regards to enabling/disabling the whole track, we were able to do it with your method but with the problem that it didn’t seem to affect the clips inside, as we wrote on the previous messages.
Thanks for the follow up and glad you’ve found a solution 🙂
Regarding disabling tracks, it needs to be done before the cutscene starts playing. Right now, if a cutscene is already playing, disabling the track in the middle of the cutscene has no effect (thus the clips are still active).
Could that be indeed the case?
Ah yes, I guess that’s the case. The cutscene starts correctly with the initial state of the option we have (subtitles on or off), and it’s only the following changes in the track that don’t affect the option. We’ll keep that in mind if we need to affect whole tracks in the future. Thanks!
Author
Posts
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.