---
tags:
    - "Movie, Film"
---

# Video Player Frame Count

[Video](../index.md) / [Video Player](index.md) / **Video Player Frame Count**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The Frame Count property of the Video Player component

## Code

```cs
// <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 Frame Count")]
    [Category("Video/Video Player/Frame Count")]
    [Description("The Frame Count property of the Video Player component")]

    [Image(typeof(IconVideo), ColorTheme.Type.Blue)]
    [Keywords("Movie, Film")]

    [Serializable]
    public class GenTypeInteger_VideoPlayer_FrameCount : 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.frameCount : default;
        }

        public override double Get(Args args)
        {
            VideoPlayer instance = this.m_VideoPlayer.Get<VideoPlayer>(args);
            return instance != null
                ? instance.frameCount
                : default;
        }

        public override string ToString()
        {
            return $"{this.m_VideoPlayer} Frame Count";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

