My game is meant to work for both PC and VR.
Sometimes I use the Camera->Fade action in ActionList or CameraFadeTrack in Timeline to darken the screen.
Generally, for PC, the MainCamera.DrawCameraFade() method detects whether MainCamera.alpha>0 or MainCamera.timelineFadeOverride==true and simply obscures the screen by drawing a texture (actualFadeTexture or timelineFadeTexture) using GUI.DrawTexture, but this doesn't work for VR.
So I created a custom fade effect using KickStarter.mainCamera.GetFadeAlpha() and KickStarter.mainCamera.GetFadeTexture() on my WorldSpace canvas.
Unfortunately, this only works for ActionList and does not work in Timeline for CameraFadeTrack.
So I decided to try to find the property responsible for Timeline and found it in MainCamera, but they are "protected" and I don't have access to them.
// Timeline
protected bool timelineOverride;
protected bool timelineFadeOverride;
protected Texture2D timelineFadeTexture;
protected float timelineFadeWeight;
I have now changed the "protected" properties to "public," and my code uses them like this:
if (isPlayableDirectorPlayingTimeline)
{
screenFaderCanvasGroup.alpha = KickStarter.mainCamera.timelineFadeWeight;
screenFaderFadingTexture.texture = KickStarter.mainCamera.timelineFadeTexture;
}
else
{
screenFaderCanvasGroup.alpha = KickStarter.mainCamera.GetFadeAlpha();
screenFaderFadingTexture.texture = KickStarter.mainCamera.GetFadeTexture();
}
And this works very well but only until the next Adventure Creator update.
Can anything be done about this?"
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I will look into it, thanks for the details.
No problem. Looking forward to any update about this.
Recreated. In v1.78.3, the GetFadeAlpha and GetFadeTexture functions will be fixed to return correct values during Timeline.
Thank you, Chris! I've tested it in v1.78.3, and it works like a charm. I appreciate the quick fix.