/// <summary>
 /// On run, this reassigns all the necessary events based on the data from the clip
 /// </summary>
 protected virtual void Awake()
 {
     if (player == null)
     {
         player = GetComponent <VideoPlayer>();
     }
     videoClipBakedMethods = new VideoClipBakedMethods(clip, data);
     videoClipBakedMethods.GetVideoClipEvents();
     videoClipBakedMethods.AssignEvents(GetComponentsInChildren <Component>());
     time = player.time.ToTime();
     Debug.Log(videoClipBakedMethods.MethodData());
 }
Exemple #2
0
        public void OnBeforeSerialize()
        {
            if (videoClip == null)
            {
                return;
            }
            VideoClipImporter importer = (VideoClipImporter)AssetImporter.GetAtPath(videoClip.originalPath);

            userData     = importer.userData;
            bakedMethods = new VideoClipBakedMethods(videoClip, userData);
            if (calllingPrefab != null)
            {
                bakedMethods.AssignEvents(calllingPrefab.GetComponentsInChildren <Component>());
            }
        }
        /// <summary>
        /// Gets all the user data from the video clip and caches the video player
        /// </summary>
        public void Init()
        {
            if (player == null)
            {
                player = GetComponent <VideoPlayer>();
            }
            clip = player.clip;
            if (clip == null)
            {
                return;
            }

            videoClipBakedMethods = new VideoClipBakedMethods(clip);
            data = videoClipBakedMethods.ClipEventData;
            videoClipBakedMethods.AssignEvents(GetComponentsInChildren <Component>());
            EditorUtility.SetDirty(this);
        }