Created
August 19, 2024 10:21
-
-
Save nickyeh97/ef8232268d2d62b95be64213f46bc02d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Video; | |
using Fungus; | |
/// <summary> | |
/// Play a video clip in the VideoPlayer. | |
/// </summary> | |
[CommandInfo("Ultrablue", | |
"PlayVideo", | |
"Play Video clip in a VideoPlayer.")] | |
[AddComponentMenu("")] | |
public class PlayVideo : Command | |
{ | |
[Tooltip("Set VideoPlayer to play VideoClip")] | |
[SerializeField] protected VideoPlayer videoPlayer; | |
[Tooltip("Set VideoClip")] | |
[SerializeField] protected VideoClip videoClip; | |
public override void OnEnter() | |
{ | |
if (videoPlayer != null && videoClip != null) | |
{ | |
videoPlayer.clip = videoClip; | |
videoPlayer.Play(); | |
} | |
Continue(); | |
} | |
public override string GetSummary() | |
{ | |
if (videoClip != null) | |
return "VideoName : " + videoClip.name; | |
else | |
return "Error: No video clip selected! "; | |
} | |
public override Color GetButtonColor() | |
{ | |
return new Color32(150, 191, 255, 255); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment