- Added trees outside the stable.

- Added a video player with horse songs preloaded.
- Adjusted post-processing to be less harsh outdoors, and more visible indoors.
This commit is contained in:
Jamie Greunbaum
2025-05-03 01:57:06 -04:00
parent dff0b4003c
commit ef9ccfef19
1183 changed files with 189695 additions and 2153 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4b09ea3d71a6c614d85d9011a8759976
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,122 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using VRC.SDK3.Components.Video;
using VRC.SDK3.Video.Components;
using VRC.SDKBase;
namespace UdonSharp.Video.Internal
{
/// <summary>
/// Allows people to put in links to YouTube videos and other supported video services and have links just work
/// Hooks into VRC's video player URL resolve callback and uses the VRC installation of YouTubeDL to resolve URLs in the editor.
/// </summary>
public static class EditorURLResolverShim
{
private static string _youtubeDLPath = "";
private static HashSet<System.Diagnostics.Process> _runningYtdlProcesses = new HashSet<System.Diagnostics.Process>();
private static HashSet<MonoBehaviour> _registeredBehaviours = new HashSet<MonoBehaviour>();
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
private static void SetupURLResolveCallback()
{
string[] splitPath = Application.persistentDataPath.Split('/', '\\');
_youtubeDLPath = string.Join("\\", splitPath.Take(splitPath.Length - 2)) + "\\VRChat\\VRChat\\Tools\\yt-dlp.exe";
if (!File.Exists(_youtubeDLPath))
{
_youtubeDLPath = string.Join("\\", splitPath.Take(splitPath.Length - 2)) + "\\VRChat\\VRChat\\Tools\\youtube-dl.exe";
}
if (!File.Exists(_youtubeDLPath))
{
Debug.LogWarning("[USharpVideo YTDL] Unable to find VRC YouTube-DL or YT-DLP installation, URLs will not be resolved in editor test your videos in game.");
return;
}
VRCUnityVideoPlayer.StartResolveURLCoroutine = ResolveURLCallback;
EditorApplication.playModeStateChanged += PlayModeChanged;
}
/// <summary>
/// Cleans up any remaining YTDL processes from this play.
/// In some cases VRC's YTDL has hung indefinitely eating CPU so this is a precaution against that potentially happening.
/// </summary>
/// <param name="change"></param>
private static void PlayModeChanged(PlayModeStateChange change)
{
if (change == PlayModeStateChange.ExitingPlayMode)
{
foreach (var process in _runningYtdlProcesses)
{
if (!process.HasExited)
{
//Debug.Log("Closing YTDL process");
process.Close();
}
}
_runningYtdlProcesses.Clear();
// Apparently the URLResolveCoroutine will run after this method in some cases magically. So don't because the process will throw an exception.
foreach (MonoBehaviour behaviour in _registeredBehaviours)
behaviour.StopAllCoroutines();
_registeredBehaviours.Clear();
}
}
private static void ResolveURLCallback(VRCUrl url, int resolution, UnityEngine.Object videoPlayer, Action<string> urlResolvedCallback, Action<VideoError> errorCallback)
{
// Broken for some unknown reason, when multiple rate limits fire off, only fires the first callback.
//if ((System.DateTime.UtcNow - lastRequestTime).TotalSeconds < 5.0)
//{
// Debug.LogWarning("Rate limited " + videoPlayer, videoPlayer);
// errorCallback(VideoError.RateLimited);
// return;
//}
var ytdlProcess = new System.Diagnostics.Process();
ytdlProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
ytdlProcess.StartInfo.CreateNoWindow = true;
ytdlProcess.StartInfo.UseShellExecute = false;
ytdlProcess.StartInfo.RedirectStandardOutput = true;
ytdlProcess.StartInfo.FileName = _youtubeDLPath;
ytdlProcess.StartInfo.Arguments = $"--no-check-certificate --no-cache-dir --rm-cache-dir -f \"mp4[height<=?{resolution}]/best[height<=?{resolution}]\" --get-url \"{url}\"";
Debug.Log($"[<color=#9C6994>USharpVideo YTDL</color>] Attempting to resolve URL '{url}'");
ytdlProcess.Start();
_runningYtdlProcesses.Add(ytdlProcess);
((MonoBehaviour)videoPlayer).StartCoroutine(URLResolveCoroutine(url.ToString(), ytdlProcess, videoPlayer, urlResolvedCallback, errorCallback));
_registeredBehaviours.Add((MonoBehaviour)videoPlayer);
}
private static IEnumerator URLResolveCoroutine(string originalUrl, System.Diagnostics.Process ytdlProcess, UnityEngine.Object videoPlayer, Action<string> urlResolvedCallback, Action<VideoError> errorCallback)
{
while (!ytdlProcess.HasExited)
yield return new WaitForSeconds(0.1f);
_runningYtdlProcesses.Remove(ytdlProcess);
string resolvedURL = ytdlProcess.StandardOutput.ReadLine();
// If a URL fails to resolve, YTDL will send error to stderror and nothing will be output to stdout
if (string.IsNullOrEmpty(resolvedURL))
errorCallback(VideoError.InvalidURL);
else
{
Debug.Log($"[<color=#9C6994>USharpVideo YTDL</color>] Successfully resolved URL '{originalUrl}' to '{resolvedURL}'");
urlResolvedCallback(resolvedURL);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1b6679862355d4468ec4673a92a84b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,155 @@
using UnityEditor;
using UdonSharpEditor;
using UnityEditorInternal;
using UnityEngine;
using VRC.SDK3.Video.Components.AVPro;
using System.Reflection;
#pragma warning disable CS0612 // Type or member is obsolete
namespace UdonSharp.Video.Internal
{
[CustomEditor(typeof(USharpVideoPlayer))]
internal class USharpVideoInspector : Editor
{
ReorderableList playlistList;
SerializedProperty allowSeekProperty;
SerializedProperty defaultUnlockedProperty;
SerializedProperty allowCreatorControlProperty;
SerializedProperty syncFrequencyProperty;
SerializedProperty syncThresholdProperty;
SerializedProperty defaultVolumeProperty;
SerializedProperty audioRangeProperty;
SerializedProperty defaultStreamMode;
SerializedProperty playlistProperty;
SerializedProperty loopPlaylistProperty;
SerializedProperty shufflePlaylistProperty;
private void OnEnable()
{
allowSeekProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.allowSeeking));
defaultUnlockedProperty = serializedObject.FindProperty("defaultUnlocked");
allowCreatorControlProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.allowInstanceCreatorControl));
syncFrequencyProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.syncFrequency));
syncThresholdProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.syncThreshold));
defaultVolumeProperty = serializedObject.FindProperty("defaultVolume");
audioRangeProperty = serializedObject.FindProperty("audioRange");
defaultStreamMode = serializedObject.FindProperty("defaultStreamMode");
playlistProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.playlist));
loopPlaylistProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.loopPlaylist));
shufflePlaylistProperty = serializedObject.FindProperty(nameof(USharpVideoPlayer.shufflePlaylist));
playlistList = new ReorderableList(serializedObject, playlistProperty, true, true, true, true);
playlistList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
{
Rect testFieldRect = new Rect(rect.x, rect.y + 2, rect.width, EditorGUIUtility.singleLineHeight);
EditorGUI.PropertyField(testFieldRect, playlistList.serializedProperty.GetArrayElementAtIndex(index), label: new GUIContent());
};
playlistList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, new GUIContent("Default Playlist URLs", "URLs that will play in sequence when you join the world until someone puts in a video.")); };
}
public override void OnInspectorGUI()
{
if (UdonSharpGUI.DrawConvertToUdonBehaviourButton(target) ||
UdonSharpGUI.DrawProgramSource(target))
return;
UdonSharpGUI.DrawUILine();
EditorGUILayout.LabelField("General", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(allowSeekProperty);
EditorGUILayout.PropertyField(defaultUnlockedProperty);
EditorGUILayout.PropertyField(allowCreatorControlProperty);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Sync", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(syncFrequencyProperty);
EditorGUILayout.PropertyField(syncThresholdProperty);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Audio", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
EditorGUILayout.PropertyField(defaultVolumeProperty);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(audioRangeProperty);
if (EditorGUI.EndChangeCheck())
{
VideoPlayerManager manager = ((Component)target).GetUdonSharpComponentInChildren<VideoPlayerManager>(true);
foreach (AudioSource source in manager.audioSources)
{
if (source)
{
Undo.RecordObject(source, "Change audio properties");
source.maxDistance = Mathf.Max(0f, audioRangeProperty.floatValue);
source.volume = defaultVolumeProperty.floatValue;
if (PrefabUtility.IsPartOfPrefabInstance(source))
PrefabUtility.RecordPrefabInstancePropertyModifications(source);
}
}
VolumeController[] volumeControllers = ((Component)target).GetUdonSharpComponentsInChildren<VolumeController>(true);
foreach (VolumeController controller in volumeControllers)
{
if (controller.slider)
{
Undo.RecordObject(controller.slider, "Change audio properties");
controller.slider.value = defaultVolumeProperty.floatValue;
if (PrefabUtility.IsPartOfPrefabInstance(controller.slider))
PrefabUtility.RecordPrefabInstancePropertyModifications(controller.slider);
}
}
}
EditorGUILayout.Space();
EditorGUILayout.LabelField("Playlist", EditorStyles.boldLabel);
playlistList.DoLayoutList();
EditorGUILayout.PropertyField(loopPlaylistProperty);
EditorGUILayout.PropertyField(shufflePlaylistProperty);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Stream Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(defaultStreamMode);
VRCAVProVideoPlayer avProPlayer = ((Component)target).GetComponentInChildren<VRCAVProVideoPlayer>(true);
if (avProPlayer)
{
EditorGUI.BeginChangeCheck();
bool newLowLatencyMode = EditorGUILayout.Toggle(new GUIContent("Low Latency Stream", "Whether the stream player should use low latency mode for RTSP streams"), avProPlayer.UseLowLatency);
if (EditorGUI.EndChangeCheck())
{
//FieldInfo lowLatencyField = typeof(VRCAVProVideoPlayer).GetField("useLowLatency", BindingFlags.Instance | BindingFlags.NonPublic);
SerializedObject avproPlayerSerializedObject = new SerializedObject(avProPlayer);
SerializedProperty lowLatencyField = avproPlayerSerializedObject.FindProperty("useLowLatency");
lowLatencyField.boolValue = newLowLatencyMode;
avproPlayerSerializedObject.ApplyModifiedProperties();
}
}
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ef31bf5c59ccb4f43b38919b302a0d27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fee9dd6648bf02a4998c9c6a06a46c78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,275 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: SyncModeController
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: af2b902d509452e45a25a068c0955bb3,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: c1060deff90de054f821a1be91da27f2, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: 3667608938212373419
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 4
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: videoPlayerControls
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: videoPlayerControls
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.VideoControlHandler, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: sliderTransform
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: sliderTransform
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.RectTransform, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _animator
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _sliderText
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _sliderText
- Name: <UserType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.UI.Text, UnityEngine.UI
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 13
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cdeaa82e9eeca4249860474b074fefa2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,49 @@
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
namespace UdonSharp.Video
{
[AddComponentMenu("Udon Sharp/Video/UI/Sync Mode Controller")]
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
public class SyncModeController : UdonSharpBehaviour
{
public VideoControlHandler videoPlayerControls;
public RectTransform sliderTransform;
Animator _animator;
Text _sliderText;
private void Start()
{
_animator = GetComponent<Animator>();
_sliderText = sliderTransform.GetComponentInChildren<Text>();
}
public void SetVideoVisual()
{
_animator.SetInteger("Target", 0);
_sliderText.text = "Video";
}
public void SetStreamVisual()
{
_animator.SetInteger("Target", 1);
_sliderText.text = "Stream";
}
public void ClickVideoToggle()
{
videoPlayerControls.OnVideoPlayerModeButtonPressed();
}
public void ClickStreamToggle()
{
videoPlayerControls.OnStreamPlayerModeButtonPressed();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c1060deff90de054f821a1be91da27f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+56
View File
@@ -0,0 +1,56 @@
using UnityEngine;
using System;
using static UdonSharp.Video.UI.UIStyleMarkup;
namespace UdonSharp.Video.UI
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
internal class StyleMarkupLinkAttribute : Attribute
{
public StyleClass Class { get; private set; }
private StyleMarkupLinkAttribute() { }
public StyleMarkupLinkAttribute(StyleClass styleClass)
{
Class = styleClass;
}
}
internal class UIStyle : ScriptableObject
{
[StyleMarkupLink(StyleClass.Background)]
public Color backgroundColor = Color.black;
[StyleMarkupLink(StyleClass.FieldBackground)]
public Color fieldBackgroundColor = Color.black;
[StyleMarkupLink(StyleClass.ButtonBackground)]
public Color buttonBackgroundColor = Color.black;
[StyleMarkupLink(StyleClass.ScrollBarHandle)]
public Color scrollBarHandleColor = Color.black;
[StyleMarkupLink(StyleClass.ScrollBarProgress)]
public Color scrollBarProgressColor = Color.black;
[StyleMarkupLink(StyleClass.Icon)]
public Color iconColor = Color.black;
[StyleMarkupLink(StyleClass.IconDropShadow)]
public Color iconDropShadowColor = Color.black;
[StyleMarkupLink(StyleClass.HighlightedButton)]
public Color highlightedButtonColor = Color.black;
[StyleMarkupLink(StyleClass.PlaceholderText)]
public Color placeholderTextColor = Color.black;
[StyleMarkupLink(StyleClass.Text)]
public Color textColor = Color.black;
[StyleMarkupLink(StyleClass.TextDropShadow)]
public Color textDropShadowColor = Color.black;
[StyleMarkupLink(StyleClass.InvertedText)]
public Color invertedTextColor = Color.black;
[StyleMarkupLink(StyleClass.RedIcon)]
public Color redIconColor = Color.black;
[StyleMarkupLink(StyleClass.InvertedIcon)]
public Color invertedIconColor = Color.black;
[StyleMarkupLink(StyleClass.TextHighlight)]
public Color textHighlightColor = Color.black;
[StyleMarkupLink(StyleClass.TextCaret)]
public Color textCaretColor = Color.white;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 447ea4bbd35f6a541adc230420ec00c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace UdonSharp.Video.UI
{
[AddComponentMenu("Udon Sharp/Video/UI/Style Markup")]
internal class UIStyleMarkup : MonoBehaviour
{
public enum StyleClass
{
Background,
FieldBackground,
ButtonBackground,
ScrollBarHandle,
ScrollBarProgress,
Icon,
IconDropShadow,
HighlightedButton,
PlaceholderText,
Text,
TextDropShadow,
InvertedText,
RedIcon,
InvertedIcon,
TextHighlight,
TextCaret,
}
#pragma warning disable CS0649
public StyleClass styleClass;
public Graphic targetGraphic;
#pragma warning restore CS0649
private void Reset()
{
hideFlags = HideFlags.DontSaveInBuild;
targetGraphic = GetComponent<Graphic>();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 785c8954a0e481d4692a9aef33de993c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+226
View File
@@ -0,0 +1,226 @@
using TMPro;
using UnityEngine;
using System.Reflection;
using System.IO;
using System.Collections.Generic;
using UnityEngine.UI;
using VRC.SDK3.Components;
#if UNITY_EDITOR
using UnityEditor;
using UdonSharpEditor;
#endif
#pragma warning disable CS0612 // Type or member is obsolete
namespace UdonSharp.Video.UI
{
[AddComponentMenu("Udon Sharp/Video/UI/Styler")]
internal class UIStyler : MonoBehaviour
{
#pragma warning disable CS0649
public UIStyle uiStyle;
#pragma warning restore CS0649
private void Reset()
{
hideFlags = HideFlags.DontSaveInBuild;
}
private static Dictionary<UIStyleMarkup.StyleClass, FieldInfo> GetStyleFieldMap()
{
Dictionary<UIStyleMarkup.StyleClass, FieldInfo> fieldLookup = new Dictionary<UIStyleMarkup.StyleClass, FieldInfo>();
foreach (FieldInfo field in typeof(UIStyle).GetFields(BindingFlags.Public | BindingFlags.Instance))
{
if (field.FieldType == typeof(Color))
{
StyleMarkupLinkAttribute markupAttr = field.GetCustomAttribute<StyleMarkupLinkAttribute>();
if (markupAttr != null)
{
fieldLookup.Add(markupAttr.Class, field);
}
}
}
return fieldLookup;
}
#if UNITY_EDITOR
private Color GetColor(FieldInfo field)
{
return (Color)field.GetValue(uiStyle);
}
public void ApplyStyle()
{
if (uiStyle == null)
return;
var lookup = GetStyleFieldMap();
UIStyleMarkup[] markups = GetComponentsInChildren<UIStyleMarkup>(true);
foreach (UIStyleMarkup markup in markups)
{
Color graphicColor = GetColor(lookup[markup.styleClass]);
if (markup.styleClass == UIStyleMarkup.StyleClass.TextHighlight)
{
InputField input = markup.GetComponent<InputField>();
TMP_InputField inputTmp = markup.GetComponent<TMP_InputField>();
VRCUrlInputField vrcInput = markup.GetComponent<VRCUrlInputField>();
if (input != null)
{
Undo.RecordObject(input, "Apply UI Style");
input.selectionColor = graphicColor;
RecordObject(input);
}
else if (inputTmp != null)
{
Undo.RecordObject(inputTmp, "Apply UI Style");
inputTmp.selectionColor = graphicColor;
RecordObject(inputTmp);
}
else if (vrcInput != null)
{
Undo.RecordObject(vrcInput, "Apply UI Style");
vrcInput.selectionColor = graphicColor;
RecordObject(vrcInput);
}
}
else if (markup.styleClass == UIStyleMarkup.StyleClass.TextCaret)
{
InputField input = markup.GetComponent<InputField>();
TMP_InputField inputTmp = markup.GetComponent<TMP_InputField>();
VRCUrlInputField vrcInput = markup.GetComponent<VRCUrlInputField>();
if (input != null)
{
Undo.RecordObject(input, "Apply UI Style");
input.caretColor = graphicColor;
RecordObject(input);
}
else if (inputTmp != null)
{
Undo.RecordObject(inputTmp, "Apply UI Style");
inputTmp.caretColor = graphicColor;
RecordObject(inputTmp);
}
else if (vrcInput != null)
{
Undo.RecordObject(vrcInput, "Apply UI Style");
vrcInput.caretColor = graphicColor;
RecordObject(vrcInput);
}
}
else if (markup.targetGraphic != null)
{
Undo.RecordObject(markup.targetGraphic, "Apply UI Style");
markup.targetGraphic.color = graphicColor;
RecordObject(markup.targetGraphic);
}
}
foreach (VideoControlHandler controlHandler in this.GetUdonSharpComponentsInChildren<VideoControlHandler>(true))
{
Undo.RecordObject(controlHandler, "Apply UI Style");
controlHandler.whiteGraphicColor = GetColor(lookup[UIStyleMarkup.StyleClass.Icon]);
controlHandler.redGraphicColor = GetColor(lookup[UIStyleMarkup.StyleClass.RedIcon]);
controlHandler.buttonBackgroundColor = GetColor(lookup[UIStyleMarkup.StyleClass.ButtonBackground]);
controlHandler.buttonActivatedColor = GetColor(lookup[UIStyleMarkup.StyleClass.HighlightedButton]);
controlHandler.iconInvertedColor = GetColor(lookup[UIStyleMarkup.StyleClass.InvertedIcon]);
controlHandler.ApplyProxyModifications();
if (PrefabUtility.IsPartOfPrefabInstance(controlHandler.gameObject))
PrefabUtility.RecordPrefabInstancePropertyModifications(UdonSharpEditorUtility.GetBackingUdonBehaviour(controlHandler));
}
}
private static void RecordObject(Object comp)
{
if (PrefabUtility.IsPartOfPrefabInstance(comp))
PrefabUtility.RecordPrefabInstancePropertyModifications(comp);
}
#endif
}
#if UNITY_EDITOR
[CustomEditor(typeof(UIStyler))]
internal class UIStylerEditor : Editor
{
private SerializedProperty colorStyleProperty;
private void OnEnable()
{
colorStyleProperty = serializedObject.FindProperty(nameof(UIStyler.uiStyle));
}
public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(colorStyleProperty);
serializedObject.ApplyModifiedProperties();
if (EditorGUI.EndChangeCheck())
(target as UIStyler).ApplyStyle();
if (colorStyleProperty.objectReferenceValue is UIStyle style)
{
//EditorGUILayout.Space();
//if (GUILayout.Button("Apply Style"))
// (target as UIStyler).ApplyStyle();
EditorGUILayout.Space();
EditorGUILayout.LabelField(ObjectNames.NicifyVariableName(style.name), EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
SerializedObject styleObj = new SerializedObject(style);
foreach (FieldInfo field in typeof(UIStyle).GetFields(BindingFlags.Public | BindingFlags.Instance))
{
SerializedProperty property = styleObj.FindProperty(field.Name);
if (property != null)
EditorGUILayout.PropertyField(property);
}
styleObj.ApplyModifiedProperties();
if (EditorGUI.EndChangeCheck())
(target as UIStyler).ApplyStyle();
}
else
{
EditorGUILayout.Space();
if (GUILayout.Button("Create New Style"))
{
string saveLocation = EditorUtility.SaveFilePanelInProject("Style save location", "Style", "asset", "Choose a save location for the new style");
if (!string.IsNullOrEmpty(saveLocation))
{
var newStyle = ScriptableObject.CreateInstance<UIStyle>();
newStyle.name = Path.GetFileNameWithoutExtension(saveLocation); // I'm not sure if the name gets updated when someone changes the name manually so this may need to be revisited
AssetDatabase.CreateAsset(newStyle, saveLocation);
AssetDatabase.SaveAssets();
serializedObject.FindProperty(nameof(UIStyler.uiStyle)).objectReferenceValue = newStyle;
serializedObject.ApplyModifiedProperties();
}
}
}
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27ce5d32713d91c4e8d5a6ec9e867dcc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,467 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: VolumeController
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: ee0e9ad97d0c8a346a10d3a8c872d2eb,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 5238e5a94111b19489a5c0a38ad6b382, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: -6346353575777764067
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 8
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: controlHandler
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: controlHandler
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.VideoControlHandler, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: slider
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: slider
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.UI.Slider, UnityEngine.UI
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: muteIcon
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: muteIcon
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: zeroVolumeIcon
- Name: $v
Entry: 7
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: zeroVolumeIcon
- Name: <UserType>k__BackingField
Entry: 9
Data: 10
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: lowVolumeIcon
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lowVolumeIcon
- Name: <UserType>k__BackingField
Entry: 9
Data: 10
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: HighVolumeIcon
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: HighVolumeIcon
- Name: <UserType>k__BackingField
Entry: 9
Data: 10
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _muted
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _muted
- Name: <UserType>k__BackingField
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _sliderValueChanging
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _sliderValueChanging
- Name: <UserType>k__BackingField
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0cfd2b8f0262db847bfb55bab92d3218
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,101 @@
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
namespace UdonSharp.Video
{
[AddComponentMenu("Udon Sharp/Video/UI/Volume Controller")]
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
public class VolumeController : UdonSharpBehaviour
{
VideoControlHandler controlHandler;
public Slider slider;
public GameObject muteIcon;
public GameObject zeroVolumeIcon;
public GameObject lowVolumeIcon;
public GameObject HighVolumeIcon;
bool _muted = false;
private void Start()
{
UpdateVolumeIcon();
}
public void SetControlHandler(VideoControlHandler handler)
{
controlHandler = handler;
}
public void SetMuted(bool muted)
{
if (muted != _muted)
{
_muted = muted;
UpdateVolumeIcon();
}
}
public void SetVolume(float volume)
{
if (!_sliderValueChanging)
{
slider.value = volume;
UpdateVolumeIcon();
}
}
bool _sliderValueChanging = false;
public void OnSliderValueChanged()
{
_sliderValueChanging = true;
if (controlHandler) controlHandler.OnVolumeSliderChange(slider.value);
_sliderValueChanging = false;
UpdateVolumeIcon();
}
public void OnMutePressed()
{
if (controlHandler) controlHandler.OnMutePress(!_muted);
}
void UpdateVolumeIcon()
{
if (_muted)
{
muteIcon.SetActive(true);
zeroVolumeIcon.SetActive(false);
lowVolumeIcon.SetActive(false);
HighVolumeIcon.SetActive(false);
}
else if (slider.value > 0.5f)
{
muteIcon.SetActive(false);
zeroVolumeIcon.SetActive(false);
lowVolumeIcon.SetActive(false);
HighVolumeIcon.SetActive(true);
}
else if (slider.value > 0f)
{
muteIcon.SetActive(false);
zeroVolumeIcon.SetActive(false);
lowVolumeIcon.SetActive(true);
HighVolumeIcon.SetActive(false);
}
else
{
muteIcon.SetActive(false);
zeroVolumeIcon.SetActive(true);
lowVolumeIcon.SetActive(false);
HighVolumeIcon.SetActive(false);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5238e5a94111b19489a5c0a38ad6b382
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71ad2ba2c082d724bbdda2d8ddd47a32
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a387f0336d7ee344baf6e00b581a5365
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 65c09211f0b51564bb059d2a669f0695
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: ObjectToggle
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: cfcba93713136274e8e3cf4739ba1998,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 534af44d52aa6244d848cf699b35f63b, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 0
hasInteractEvent: 0
scriptID: 2921915411753127676
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: toggleObjects
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: toggleObjects
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.GameObject[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 5|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b0c60135ec3e09e4796af91290498d4b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace UdonSharp.Video.Internal
{
[AddComponentMenu("Udon Sharp/Video/Internal/Object Toggle")]
public class ObjectToggle : UdonSharpBehaviour
{
#pragma warning disable CS0649
[SerializeField]
private GameObject[] toggleObjects;
#pragma warning restore CS0649
public void OnToggle()
{
foreach (GameObject toggleObject in toggleObjects)
{
toggleObject.SetActive(!toggleObject.activeSelf);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 534af44d52aa6244d848cf699b35f63b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,335 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: RenderTextureOutput
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 6a4450dd72b0ab44693e2c2a77dccf00,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: f3b10bdb649b9b44b813fd2f9684bcc4, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: 3881543708348707588
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 5
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: sourceVideoPlayer
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: sourceVideoPlayer
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.USharpVideoPlayer, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: videoPlayerManager
- Name: $v
Entry: 7
Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: videoPlayerManager
- Name: <UserType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.VideoPlayerManager, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 4
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: outputTexture
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: outputTexture
- Name: <UserType>k__BackingField
Entry: 7
Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.CustomRenderTexture, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 11
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: outputMat
- Name: $v
Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: outputMat
- Name: <UserType>k__BackingField
Entry: 7
Data: 14|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 14
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: lastTex
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastTex
- Name: <UserType>k__BackingField
Entry: 7
Data: 17|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Texture, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 17
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c18f674abe767a840b312f8bc3954dbc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,147 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using System.IO;
#if UNITY_EDITOR && !COMPILER_UDONSHARP
using UnityEditor;
using UdonSharpEditor;
#endif
#pragma warning disable CS0612 // Type or member is obsolete
namespace UdonSharp.Video
{
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
[AddComponentMenu("Udon Sharp/Video/Utilities/Render Texture Output")]
public class RenderTextureOutput : UdonSharpBehaviour
{
#pragma warning disable CS0649
[SerializeField]
private USharpVideoPlayer sourceVideoPlayer;
private VideoPlayerManager videoPlayerManager;
#pragma warning restore CS0649
public CustomRenderTexture outputTexture;
private Material outputMat;
private void Start()
{
outputMat = outputTexture.material;
videoPlayerManager = sourceVideoPlayer.GetComponentInChildren<VideoPlayerManager>(true);
}
private Texture lastTex;
private void LateUpdate()
{
Texture videoPlayerTex = videoPlayerManager.GetVideoTexture();
if (lastTex != videoPlayerTex)
{
outputMat.SetTexture("_SourceTexture", videoPlayerTex);
outputMat.SetInt("_IsAVPro", System.Convert.ToInt32(sourceVideoPlayer.IsUsingAVProPlayer()));
lastTex = videoPlayerTex;
}
}
}
#if UNITY_EDITOR && !COMPILER_UDONSHARP
[CustomEditor(typeof(RenderTextureOutput))]
internal class RenderTextureOutputInspector : Editor
{
internal class RenderTextureCreator : EditorWindow
{
public RenderTextureOutput targetOutput;
private Vector2Int resolution = new Vector2Int(1920, 1080);
private void OnGUI()
{
targetOutput = (RenderTextureOutput)EditorGUILayout.ObjectField("Target component", targetOutput, typeof(RenderTextureOutput), true);
resolution = EditorGUILayout.Vector2IntField("Resolution", resolution);
if (GUILayout.Button("Create Texture"))
{
CreateCRT();
}
}
void CreateCRT()
{
string filePath = EditorUtility.SaveFilePanelInProject("Texture save", "VideoOutputTexture", "asset", "Choose a name for the texture file");
if (string.IsNullOrEmpty(filePath))
return;
CustomRenderTexture newCRT = new CustomRenderTexture(resolution.x, resolution.y, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB);
newCRT.autoGenerateMips = false;
newCRT.initializationMode = CustomRenderTextureUpdateMode.OnLoad;
newCRT.initializationColor = Color.black;
newCRT.initializationSource = CustomRenderTextureInitializationSource.TextureAndColor;
newCRT.depth = 0;
newCRT.updateMode = CustomRenderTextureUpdateMode.Realtime;
Material updateMat = new Material(Shader.Find("Merlin/World/Render Texture Processor"));
updateMat.name = $"{Path.GetFileNameWithoutExtension(filePath)}_Update";
updateMat.SetFloat("_TargetAspectRatio", resolution.x / (float)resolution.y);
AssetDatabase.CreateAsset(newCRT, filePath);
AssetDatabase.AddObjectToAsset(updateMat, newCRT);
AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(updateMat));
newCRT.material = updateMat;
AssetDatabase.SaveAssets();
targetOutput.outputTexture = newCRT;
targetOutput.ApplyProxyModifications();
}
}
private SerializedProperty sourceVideoPlayerProperty;
private SerializedProperty outputTextureProperty;
private void OnEnable()
{
sourceVideoPlayerProperty = serializedObject.FindProperty("sourceVideoPlayer");
outputTextureProperty = serializedObject.FindProperty("outputTexture");
}
public override void OnInspectorGUI()
{
if (UdonSharpGUI.DrawDefaultUdonSharpBehaviourHeader(target)) return;
EditorGUILayout.PropertyField(sourceVideoPlayerProperty);
if (sourceVideoPlayerProperty.objectReferenceValue == null)
EditorGUILayout.HelpBox("A source video player must be specified", MessageType.Error);
EditorGUILayout.PropertyField(outputTextureProperty);
serializedObject.ApplyModifiedProperties();
RenderTextureOutput output = (RenderTextureOutput)target;
if (output.outputTexture == null)
{
EditorGUILayout.Space();
if (GUILayout.Button("Setup Output Texture", GUILayout.Height(30f)))
{
RenderTextureCreator window = EditorWindow.GetWindow<RenderTextureCreator>(false, "Render Texture Creator");
window.targetOutput = output;
window.maxSize = new Vector2(450f, 100f);
window.minSize = new Vector2(450f, 100f);
}
}
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f3b10bdb649b9b44b813fd2f9684bcc4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,107 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: RendererGIUpdate
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: edcf554b1506ca3468a47fb02d8f7238,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: b87e785a55735d44796c45b54f07339f, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: -2201767513812594064
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: targetRenderer
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: targetRenderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 553f0db2752ead24590f8ac2e1f80c06
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
namespace UdonSharp.Video
{
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
[AddComponentMenu("Udon Sharp/Video/Utilities/Renderer GI Update")]
public class RendererGIUpdate : UdonSharpBehaviour
{
private Renderer targetRenderer;
void Start()
{
targetRenderer = GetComponent<Renderer>();
}
private void Update()
{
RendererExtensions.UpdateGIMaterials(targetRenderer);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b87e785a55735d44796c45b54f07339f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,557 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: VideoScreenHandler
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 40b36844db0b30645b4215ab8eb050cc,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: a8947e6a8f7f7b24a9a65140fa6bf344, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: -2545927122447167997
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 8
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: sourceVideoPlayer
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: sourceVideoPlayer
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.USharpVideoPlayer, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 3
- Name:
Entry: 7
Data: 6|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 7|JetBrains.Annotations.NotNullAttribute, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 8|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: The video player that this pulls from
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: texParam
- Name: $v
Entry: 7
Data: 9|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: texParam
- Name: <UserType>k__BackingField
Entry: 7
Data: 10|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 12|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Renderer
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 13|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Name of parameter the shader on this renderer uses for the video texture
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: avProToggleParam
- Name: $v
Entry: 7
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: avProToggleParam
- Name: <UserType>k__BackingField
Entry: 9
Data: 10
- Name: <SystemType>k__BackingField
Entry: 9
Data: 10
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 16|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Name of the parameter the shader on this renderer uses to determine if
it should preform color and UV correction on the render texture
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: useSharedMaterial
- Name: $v
Entry: 7
Data: 17|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: useSharedMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 18|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 18
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 20|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Sets render textures on the renderer's shared material which allows multiple
screens to share the same texture and batch
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: rendererIndex
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: rendererIndex
- Name: <UserType>k__BackingField
Entry: 7
Data: 22|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 22
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 24|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: The index of the renderer to set the video texture on
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: standbyTexture
- Name: $v
Entry: 7
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: standbyTexture
- Name: <UserType>k__BackingField
Entry: 7
Data: 26|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Texture, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 28|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Texture that will be shown on the screen when the video player is not
playing a video
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: targetRenderer
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: targetRenderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 30|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: lastRenderTexture
- Name: $v
Entry: 7
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: lastRenderTexture
- Name: <UserType>k__BackingField
Entry: 9
Data: 26
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 358a98096f2187c4eb0cee20115d2f3a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,122 @@
using JetBrains.Annotations;
using UdonSharp;
using UnityEngine;
namespace UdonSharp.Video
{
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
[AddComponentMenu("Udon Sharp/Video/Utilities/Video Screen Handler")]
public class VideoScreenHandler : UdonSharpBehaviour
{
[SerializeField, NotNull, Tooltip("The video player that this pulls from")]
private USharpVideoPlayer sourceVideoPlayer;
[Header("Renderer")]
[Tooltip("Name of parameter the shader on this renderer uses for the video texture")]
public string texParam = "_EmissionMap";
[Tooltip("Name of the parameter the shader on this renderer uses to determine if it should preform color and UV correction on the render texture")]
public string avProToggleParam = "_IsAVProInput";
[Tooltip("Sets render textures on the renderer's shared material which allows multiple screens to share the same texture and batch")]
public bool useSharedMaterial = false;
[Tooltip("The index of the renderer to set the video texture on")]
public int rendererIndex = 0;
[Tooltip("Texture that will be shown on the screen when the video player is not playing a video")]
public Texture standbyTexture;
private Renderer targetRenderer;
private Texture lastRenderTexture;
private void Start()
{
targetRenderer = GetComponent<Renderer>();
OnEnable();
}
private void OnEnable()
{
SetSourceVideoPlayer(sourceVideoPlayer);
}
private void OnDisable()
{
if (sourceVideoPlayer)
sourceVideoPlayer.UnregisterScreenHandler(this);
}
[PublicAPI]
public Texture GetVideoTexture()
{
return lastRenderTexture;
}
public void UpdateVideoTexture(Texture renderTexture, bool isAVPro)
{
if (renderTexture == lastRenderTexture)
return;
if (targetRenderer)
{
Material rendererMat;
// Sadly we can't use property blocks and respect the renderer index at the same time when shared materials are disabled.
// This is because Unity is bad. Specifically when you set a property block with a specific material index, realtime GI updates do not detect the binding.
if (useSharedMaterial)
rendererMat = targetRenderer.sharedMaterials[rendererIndex];
else
rendererMat = targetRenderer.materials[rendererIndex];
if (renderTexture != null)
{
rendererMat.SetTexture(texParam, renderTexture);
if (!string.IsNullOrEmpty(avProToggleParam))
rendererMat.SetInt(avProToggleParam, isAVPro ? 1 : 0);
}
else
{
rendererMat.SetTexture(texParam, standbyTexture);
rendererMat.SetInt(avProToggleParam, 0);
}
}
lastRenderTexture = renderTexture;
//if (renderTexture == null)
// Debug.Log("Null texture set");
//else
// Debug.Log("Set tex to " + renderTexture);
}
public void SetToStandby()
{
Material rendererMat;
if (useSharedMaterial)
rendererMat = targetRenderer.sharedMaterials[rendererIndex];
else
rendererMat = targetRenderer.materials[rendererIndex];
rendererMat.SetTexture(texParam, standbyTexture);
if (!string.IsNullOrEmpty(avProToggleParam))
rendererMat.SetInt(avProToggleParam, 0);
}
[PublicAPI]
public void SetSourceVideoPlayer(USharpVideoPlayer sourcePlayer)
{
if (sourcePlayer)
{
sourceVideoPlayer.UnregisterScreenHandler(this);
sourceVideoPlayer = sourcePlayer;
sourceVideoPlayer.RegisterScreenHandler(this);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8947e6a8f7f7b24a9a65140fa6bf344
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7021d3ad08c81d54c8598190c706a0c5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,421 @@
using JetBrains.Annotations;
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDK3.Components;
using VRC.SDKBase;
namespace UdonSharp.Video
{
[DefaultExecutionOrder(10)]
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
[AddComponentMenu("Udon Sharp/Video/UI/Video Control Handler")]
public class VideoControlHandler : UdonSharpBehaviour
{
/// <summary>
/// The video player this UI instance controls and pulls info from
/// </summary>
[PublicAPI, NotNull]
public USharpVideoPlayer targetVideoPlayer;
#pragma warning disable CS0649
[SerializeField]
private VRCUrlInputField urlField;
[SerializeField]
private Text urlFieldPlaceholderText;
[Header("Status text")]
[SerializeField]
private Text statusTextField;
[SerializeField]
private Text statusTextDropShadow;
[Header("Video progress bar")]
[SerializeField]
private Slider progressSlider;
[Header("Lock button")]
[SerializeField]
private Graphic lockGraphic;
[SerializeField]
private GameObject masterLockedIcon, masterUnlockedIcon;
[Header("Info panel fields")]
[SerializeField]
private Text masterField;
[SerializeField]
private Text ownerField;
[SerializeField]
private InputField currentURLField, previousURLField;
[Header("Play/Pause/Stop buttons")]
[SerializeField]
private GameObject pauseStopObject;
[SerializeField]
private GameObject playObject;
[SerializeField]
private GameObject pauseIcon, stopIcon;
[Header("Loop button")]
[SerializeField]
private Graphic loopButtonBackground;
[SerializeField]
private Graphic loopButtonIcon;
[Header("Video/Stream controls")]
[SerializeField]
private SyncModeController syncController;
[Header("Volume")]
[SerializeField]
private VolumeController volumeController;
[Header("Style Colors")]
public Color redGraphicColor = new Color(0.632f, 0.19f, 0.19f);
public Color whiteGraphicColor = new Color(0.9433f, 0.9433f, 0.9433f);
public Color buttonBackgroundColor = new Color(1f, 1f, 1f, 1f);
public Color buttonActivatedColor = new Color(1f, 1f, 1f, 1f);
public Color iconInvertedColor = new Color(1f, 1f, 1f, 1f);
#pragma warning restore CS0649
private void OnEnable()
{
targetVideoPlayer.RegisterControlHandler(this);
UpdateMaster();
UpdateVideoOwner();
if (volumeController) volumeController.SetControlHandler(this);
}
private void OnDisable()
{
targetVideoPlayer.UnregisterControlHandler(this);
}
// Only allow the master to own this so we can check master by checking this object's owner
public override bool OnOwnershipRequest(VRCPlayerApi requestingPlayer, VRCPlayerApi requestedOwner)
{
return false;
}
private void Update()
{
RunUIUpdate();
}
public override void OnPlayerLeft(VRCPlayerApi player)
{
UpdateMaster();
}
public void OnVideoPlayerOwnerTransferred()
{
UpdateVideoOwner();
}
void UpdateMaster()
{
#if !UNITY_EDITOR
// We know the owner of this will always be the master so just get the owner and update the name
if (masterField)
{
VRCPlayerApi owner = Networking.GetOwner(gameObject);
if (owner != null && owner.IsValid())
masterField.text = Networking.GetOwner(gameObject).displayName;
}
#endif
}
private void UpdateVideoOwner()
{
#if !UNITY_EDITOR
if (ownerField)
ownerField.text = Networking.GetOwner(targetVideoPlayer.gameObject).displayName;
#endif
SetLocked(targetVideoPlayer.IsLocked());
}
[PublicAPI]
public void SetControlledVideoPlayer(USharpVideoPlayer newPlayer)
{
if (newPlayer == targetVideoPlayer)
return;
targetVideoPlayer.UnregisterControlHandler(this);
targetVideoPlayer = newPlayer;
targetVideoPlayer.RegisterControlHandler(this);
UpdateVideoOwner();
SetStatusText("");
_draggingSlider = false;
}
string _currentStatusText = "";
public void SetStatusText(string newStatus)
{
_currentStatusText = newStatus;
if (statusTextField) statusTextField.text = _currentStatusText;
if (statusTextDropShadow) statusTextDropShadow.text = _currentStatusText;
_lastTime = int.MaxValue;
}
public void SetLocked(bool locked)
{
if (locked)
{
if (masterLockedIcon) masterLockedIcon.SetActive(true);
if (masterUnlockedIcon) masterUnlockedIcon.SetActive(false);
if (Networking.IsOwner(targetVideoPlayer.gameObject) || targetVideoPlayer.CanControlVideoPlayer())
{
if (lockGraphic) lockGraphic.color = whiteGraphicColor;
if (urlFieldPlaceholderText) urlFieldPlaceholderText.text = "Enter Video URL...";
}
else
{
if (lockGraphic) lockGraphic.color = redGraphicColor;
if (urlFieldPlaceholderText) urlFieldPlaceholderText.text = $"Only the master {Networking.GetOwner(targetVideoPlayer.gameObject).displayName} may add URLs";
}
}
else
{
if (masterLockedIcon) masterLockedIcon.SetActive(false);
if (masterUnlockedIcon) masterUnlockedIcon.SetActive(true);
if (lockGraphic) lockGraphic.color = whiteGraphicColor;
if (urlFieldPlaceholderText) urlFieldPlaceholderText.text = "Enter Video URL... (anyone)";
}
}
public void SetPaused(bool paused)
{
bool videoMode = targetVideoPlayer.IsInVideoMode();
if (pauseIcon) pauseIcon.SetActive(videoMode);
if (stopIcon) stopIcon.SetActive(!videoMode);
if (playObject) playObject.SetActive(paused);
if (pauseStopObject) pauseStopObject.SetActive(!paused);
}
public void SetLooping(bool looping)
{
if (looping)
{
if (loopButtonBackground) loopButtonBackground.color = buttonActivatedColor;
if (loopButtonIcon) loopButtonIcon.color = iconInvertedColor;
}
else
{
if (loopButtonBackground) loopButtonBackground.color = buttonBackgroundColor;
if (loopButtonIcon) loopButtonIcon.color = whiteGraphicColor;
}
}
public void SetVolume(float volume)
{
if (volumeController) volumeController.SetVolume(volume);
}
public void SetMuted(bool muted)
{
if (volumeController) volumeController.SetMuted(muted);
}
public void OnVolumeSliderChange(float volume)
{
targetVideoPlayer.SetVolume(volume);
}
public void OnMutePress(bool muted)
{
targetVideoPlayer.SetMuted(muted);
}
/// <summary>
/// Adds a URL to the history display so people can copy it
/// </summary>
/// <param name="url"></param>
public void AddURLToHistory(VRCUrl url)
{
if (currentURLField)
{
if (previousURLField)
previousURLField.text = currentURLField.text;
currentURLField.text = url.Get();
}
}
public void SetToVideoPlayerMode()
{
if (syncController)
syncController.SetVideoVisual();
}
public void SetToStreamPlayerMode()
{
if (syncController)
syncController.SetStreamVisual();
}
private int _lastTime = int.MaxValue;
/// <summary>
/// Updates UI elements such as the time readout, URL views, and seek bar
/// </summary>
private void RunUIUpdate()
{
if (targetVideoPlayer.IsInVideoMode())
{
VideoPlayerManager manager = targetVideoPlayer.GetVideoManager();
float duration = manager.GetDuration();
if (_draggingSlider)
{
float currentProgress = progressSlider.value;
float currentTime = duration * currentProgress;
targetVideoPlayer.SeekTo(currentProgress);
string currentTimeStr = GetFormattedTime(System.TimeSpan.FromSeconds(currentTime));
if (statusTextField) statusTextField.text = currentTimeStr;
if (statusTextDropShadow) statusTextDropShadow.text = currentTimeStr;
}
else
{
float currentTime = manager.GetTime();
if (progressSlider)
{
if (duration > 0f)
{
progressSlider.gameObject.SetActive(true);
progressSlider.value = Mathf.Clamp01(currentTime / duration);
}
else
{
progressSlider.gameObject.SetActive(false);
}
}
int currentTimeInt = Mathf.RoundToInt(currentTime);
if (currentTimeInt != _lastTime)
{
_lastTime = currentTimeInt;
if (!float.IsInfinity(duration) & duration != float.MaxValue)
{
if (string.IsNullOrEmpty(_currentStatusText))
{
System.TimeSpan durationTimespan = System.TimeSpan.FromSeconds(duration);
System.TimeSpan currentTimeTimespan = System.TimeSpan.FromSeconds(currentTime);
string totalTimeStr = GetFormattedTime(durationTimespan);
string currentTimeStr = GetFormattedTime(currentTimeTimespan);
string statusStr = currentTimeStr + "/" + totalTimeStr;
if (statusTextField) statusTextField.text = statusStr;
if (statusTextDropShadow) statusTextDropShadow.text = statusStr;
}
}
}
}
}
else
{
if (progressSlider) progressSlider.gameObject.SetActive(false);
}
}
/// <summary>
/// Gets a time string in the format hh:mm:ss, handles hours properly for long-running videos that wrap the hh section.
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
private string GetFormattedTime(System.TimeSpan time)
{
return ((int)time.TotalHours).ToString("D2") + time.ToString(@"\:mm\:ss");
}
/// <summary>
/// Called when the user enters a URL in the url input field, forwards the input to the video player
/// </summary>
public void OnURLInput()
{
targetVideoPlayer.PlayVideo(urlField.GetUrl());
urlField.SetUrl(VRCUrl.Empty);
}
/// <summary>
/// Fired when the play button, pause button, or stop button are pressed.
/// </summary>
public void OnPlayButtonPress()
{
targetVideoPlayer.SetPaused(!targetVideoPlayer.IsPaused());
}
public void OnLockButtonPress()
{
if (targetVideoPlayer.IsPrivilegedUser(Networking.LocalPlayer))
{
targetVideoPlayer.TakeOwnership();
targetVideoPlayer.SetLocked(!targetVideoPlayer.IsLocked());
}
}
public void OnReloadButtonPressed()
{
targetVideoPlayer.Reload();
}
public void OnLoopButtonPressed()
{
targetVideoPlayer.TakeOwnership();
targetVideoPlayer.SetLooping(!targetVideoPlayer.IsLooping());
}
public void OnVideoPlayerModeButtonPressed()
{
targetVideoPlayer.SetToUnityPlayer();
}
public void OnStreamPlayerModeButtonPressed()
{
targetVideoPlayer.SetToAVProPlayer();
}
public void OnSeekSliderChanged()
{
//if (!_draggingSlider)
// return;
}
private bool _draggingSlider;
public void OnSeekSliderBeginDrag()
{
if (Networking.IsOwner(targetVideoPlayer.gameObject))
_draggingSlider = true;
}
public void OnSeekSliderEndDrag()
{
_draggingSlider = false;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0ce6496606301e64ea5fb1e7516662c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,695 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: VideoPlayerManager
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 1f2f968cb52ea9244b03007e6c242805,
type: 2}
udonAssembly:
assemblyError:
sourceCsScript: {fileID: 11500000, guid: 61a08afb94ef7364d8358a64333fb431, type: 3}
scriptVersion: 2
compiledVersion: 2
behaviourSyncMode: 2
hasInteractEvent: 0
scriptID: -2460508589215210098
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: fieldDefinitions
Entry: 7
Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition,
UdonSharp.Editor]], mscorlib
- Name: comparer
Entry: 7
Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String,
mscorlib]], mscorlib
- Name:
Entry: 8
Data:
- Name:
Entry: 12
Data: 12
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: receiver
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: receiver
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UdonSharp.Video.USharpVideoPlayer, Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 4|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.Udon.UdonBehaviour, VRC.Udon
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: unityVideoPlayer
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: unityVideoPlayer
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Video.Components.VRCUnityVideoPlayer, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 8|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Video.Components.Base.BaseVRCVideoPlayer, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: avProPlayer
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: avProPlayer
- Name: <UserType>k__BackingField
Entry: 7
Data: 11|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Video.Components.AVPro.VRCAVProVideoPlayer, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 12|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: unityTextureRenderer
- Name: $v
Entry: 7
Data: 13|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: unityTextureRenderer
- Name: <UserType>k__BackingField
Entry: 7
Data: 14|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Renderer, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 14
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 15|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: avProTextureRenderer
- Name: $v
Entry: 7
Data: 16|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: avProTextureRenderer
- Name: <UserType>k__BackingField
Entry: 9
Data: 14
- Name: <SystemType>k__BackingField
Entry: 9
Data: 14
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 17|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: audioSources
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: audioSources
- Name: <UserType>k__BackingField
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioSource[], UnityEngine.AudioModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _currentPlayer
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentPlayer
- Name: <UserType>k__BackingField
Entry: 9
Data: 8
- Name: <SystemType>k__BackingField
Entry: 9
Data: 8
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _fetchBlock
- Name: $v
Entry: 7
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _fetchBlock
- Name: <UserType>k__BackingField
Entry: 7
Data: 24|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.MaterialPropertyBlock, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 24
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: avproFetchMaterial
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: avproFetchMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 27
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _initialized
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _initialized
- Name: <UserType>k__BackingField
Entry: 7
Data: 30|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _currentVolume
- Name: $v
Entry: 7
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentVolume
- Name: <UserType>k__BackingField
Entry: 7
Data: 33|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 33
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _currentlyMuted
- Name: $v
Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentlyMuted
- Name: <UserType>k__BackingField
Entry: 9
Data: 30
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e90e65c11b3fae4c90c1b55d4472db7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,214 @@
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
using VRC.SDK3.Video.Components;
using VRC.SDK3.Video.Components.AVPro;
using VRC.SDK3.Video.Components.Base;
#if UNITY_EDITOR && !COMPILER_UDONSHARP
using UnityEditor;
using UdonSharpEditor;
#endif
#pragma warning disable CS0612 // Type or member is obsolete
namespace UdonSharp.Video
{
/// <summary>
/// Forwards events sent by Udon video player components to the main video player controller and further abstracts the video players between AVPro and Unity players
/// This exists so that we can put the Udon video player components on a different object from the main video player
/// Prior to using this, people would get confused and change settings on the Udon video player components which would break things
/// </summary>
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
[AddComponentMenu("Udon Sharp/Video/Internal/Video Player Manager")]
public class VideoPlayerManager : UdonSharpBehaviour
{
public USharpVideoPlayer receiver;
public VRCUnityVideoPlayer unityVideoPlayer;
public VRCAVProVideoPlayer avProPlayer;
public Renderer unityTextureRenderer;
public Renderer avProTextureRenderer;
public AudioSource[] audioSources;
private BaseVRCVideoPlayer _currentPlayer;
private MaterialPropertyBlock _fetchBlock;
private Material avproFetchMaterial;
private bool _initialized;
public void Start()
{
if (_initialized)
return;
_currentPlayer = unityVideoPlayer;
Material m = unityTextureRenderer.material;
m = avProTextureRenderer.material;
_fetchBlock = new MaterialPropertyBlock();
avproFetchMaterial = avProTextureRenderer.material;
_initialized = true;
}
public override void OnVideoEnd()
{
receiver.OnVideoEnd();
}
public override void OnVideoError(VRC.SDK3.Components.Video.VideoError videoError)
{
receiver._OnVideoErrorCallback(videoError);
}
public override void OnVideoLoop()
{
receiver.OnVideoLoop();
}
public override void OnVideoPause()
{
receiver.OnVideoPause();
}
public override void OnVideoPlay()
{
receiver.OnVideoPlay();
}
public override void OnVideoReady()
{
receiver.OnVideoReady();
}
public override void OnVideoStart()
{
receiver.OnVideoStart();
}
public void Play() => _currentPlayer.Play();
public void Pause() => _currentPlayer.Pause();
public void Stop() => _currentPlayer.Stop();
public float GetTime() => _currentPlayer.GetTime();
public float GetDuration() => _currentPlayer.GetDuration();
public bool IsPlaying() => _currentPlayer.IsPlaying;
public void LoadURL(VRCUrl url) => _currentPlayer.LoadURL(url);
public void SetTime(float time) => _currentPlayer.SetTime(time);
public void SetLooping(bool loop)
{
unityVideoPlayer.Loop = loop;
avProPlayer.Loop = loop;
}
public void SetToStreamPlayerMode()
{
if (_currentPlayer == avProPlayer)
return;
_currentPlayer.Stop();
_currentPlayer = avProPlayer;
}
public void SetToVideoPlayerMode()
{
if (_currentPlayer == unityVideoPlayer)
return;
_currentPlayer.Stop();
_currentPlayer = unityVideoPlayer;
}
public Texture GetVideoTexture()
{
if (_currentPlayer == unityVideoPlayer)
{
unityTextureRenderer.GetPropertyBlock(_fetchBlock);
return _fetchBlock.GetTexture("_MainTex");
}
else
{
return avproFetchMaterial.GetTexture("_MainTex");
}
}
private float _currentVolume = 1f;
private bool _currentlyMuted;
public float GetVolume() => _currentVolume;
public bool IsMuted() => _currentlyMuted;
public void SetVolume(float volume)
{
if (!_currentlyMuted)
{
// https://www.dr-lex.be/info-stuff/volumecontrols.html#ideal thanks TCL for help with finding and understanding this
// Using the 50dB dynamic range constants
float adjustedVolume = Mathf.Clamp01(3.1623e-3f * Mathf.Exp(volume * 5.757f) - 3.1623e-3f);
foreach (AudioSource audioSource in audioSources)
audioSource.volume = adjustedVolume;
}
_currentVolume = volume;
}
public void SetMuted(bool muted)
{
_currentlyMuted = muted;
if (muted)
{
foreach (AudioSource audioSource in audioSources)
audioSource.volume = 0f;
}
else
{
SetVolume(_currentVolume);
}
}
}
#if UNITY_EDITOR && !COMPILER_UDONSHARP
[CustomEditor(typeof(VideoPlayerManager))]
internal class VideoPlayerManagerInspector : Editor
{
private SerializedProperty receiverProperty;
private SerializedProperty unityVideoProperty;
private SerializedProperty avProVideoProperty;
private SerializedProperty unityRendererProperty;
private SerializedProperty avProRendererProperty;
private SerializedProperty audioSourcesProperty;
private void OnEnable()
{
receiverProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.receiver));
unityVideoProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.unityVideoPlayer));
avProVideoProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.avProPlayer));
unityRendererProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.unityTextureRenderer));
avProRendererProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.avProTextureRenderer));
audioSourcesProperty = serializedObject.FindProperty(nameof(VideoPlayerManager.audioSources));
}
public override void OnInspectorGUI()
{
if (UdonSharpGUI.DrawConvertToUdonBehaviourButton(target)) return;
if (UdonSharpGUI.DrawProgramSource(target, false)) return;
EditorGUILayout.HelpBox("Do not modify the video players on this game object, all modifications must be done on the USharpVideoPlayer. If you change the settings on these, you will break things.", MessageType.Warning);
EditorGUILayout.PropertyField(receiverProperty);
EditorGUILayout.PropertyField(unityVideoProperty);
EditorGUILayout.PropertyField(avProVideoProperty);
EditorGUILayout.PropertyField(unityRendererProperty);
EditorGUILayout.PropertyField(avProRendererProperty);
EditorGUILayout.PropertyField(audioSourcesProperty, true);
serializedObject.ApplyModifiedProperties();
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61a08afb94ef7364d8358a64333fb431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: