`playVideo' 没有实现接口成员

`playVideo' does not implement interface member

我是 C# 的新手,所以我不确定这个错误是什么意思。 playVideo' does not implement interface memberVuforia.ITrackableEventHandler.OnTrackableStateChanged(Vuforia.TrackableBehaviour.Status, Vuforia.TrackableBehaviour.Status)' 这是我的代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
using Vuforia;

public class playVideo : MonoBehaviour, ITrackableEventHandler{

    public VideoClip videoToPlay;
    public GameObject cubeObject;
    private VideoPlayer videoPlayer;
    private VideoSource videoSource;
    private AudioSource audioSource;

    public void OnTrackableStateChanged (TrackableBehaviour.Status newStatus) {
        Debug.Log (newStatus);
        if (newStatus == TrackableBehaviour.Status.DETECTED||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
        {
            Debug.Log ("Status Changed");
            videoPlayer = gameObject.AddComponent<VideoPlayer> ();
            audioSource = gameObject.AddComponent<AudioSource> ();

            videoPlayer.playOnAwake = false;
            audioSource.playOnAwake = false;

            videoPlayer.source = VideoSource.VideoClip;

            videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;

            videoPlayer.EnableAudioTrack (0, true);
            videoPlayer.SetTargetAudioSource (0, audioSource);

            videoPlayer.clip = videoToPlay;
            videoPlayer.Prepare ();


            videoPlayer.Play ();
            audioSource.Play ();
        }
    }
}

当您实现 ITrackableEventHandler 接口时,要实现的函数需要两个参数而不是一个。

替换

public void OnTrackableStateChanged (TrackableBehaviour.Status newStatus) 

public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)

参考ITrackableEventHandler界面source code获取更多信息。