using UnityEngine; using UnityEditor; [CustomEditor(typeof(VideoAsset))] [CanEditMultipleObjects] public class VideoAssetEditor : Editor { public override void OnInspectorGUI() { // Draw the default inspector first DrawDefaultInspector(); // Add a space in the inspector EditorGUILayout.Space(); if (targets.Length > 1 && GUILayout.Button("Clear Video Clips")) { // Iterate over all selected objects (targets) foreach (var obj in targets) { VideoAsset videoAsset = (VideoAsset)obj; // Set the videoClip to null for each object videoAsset.videoClip = null; // Mark the object as dirty so that the change persists EditorUtility.SetDirty(videoAsset); } } else if (target != null) { VideoAsset videoAsset = (VideoAsset)target; // Add a button that sets the videoClip to null if (GUILayout.Button("Clear Video Clip")) { videoAsset.videoClip = null; // Mark the object as dirty so that the change persists EditorUtility.SetDirty(videoAsset); } if (GUILayout.Button("Load Video Clip")) { videoAsset.DownloadVideoInEditor(); } } } }