Video Player Length#
Video / Video Player / Video Player Length
Can Read
Cannot Write
Description#
The Length property of the Video Player component
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.Video;
namespace VisualScript.Runtime
{
[Get]
[Title("Video Player Length")]
[Category("Video/Video Player/Length")]
[Description("The Length property of the Video Player component")]
[Image(typeof(IconVideo), ColorTheme.Type.Blue)]
[Keywords("Movie, Film")]
[Serializable]
public class GenTypeNumber_VideoPlayer_Length : TypeNumber
{
[SerializeField] private GetGameObject m_VideoPlayer = new GetGameObject(
new GenTypeGameObject_VideoPlayer()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_VideoPlayer.GetPreview(source);
if (instance == null) return default;
VideoPlayer component = instance.GetComponent<VideoPlayer>();
return component != null ? component.length : default;
}
public override double Get(Args args)
{
VideoPlayer instance = this.m_VideoPlayer.Get<VideoPlayer>(args);
return instance != null
? instance.length
: default;
}
public override string ToString()
{
return $"{this.m_VideoPlayer} Length";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}