예제 #1
0
        /// <summary>
        /// Estimate the memory usage in bytes from the storage of snapshots for the current recording duration and interval.
        /// </summary>
        public int EstimateMemoryUsage()
        {
            if (Application.isPlaying)
            {
                return(activeRecorders.Sum(r => r.EstimateMemoryUsage()));
            }
            else
            {
                if (!recordTransform)
                {
                    return(0);
                }

                if (GetComponent <Rigidbody>() != null)
                {
                    return(RigidbodyTimeline3D.EstimateMemoryUsage(recordingDuration, recordingInterval));
                }
                else if (GetComponent <Rigidbody2D>() != null)
                {
                    return(RigidbodyTimeline2D.EstimateMemoryUsage(recordingDuration, recordingInterval));
                }
                else if (GetComponent <Transform>() != null)
                {
                    return(TransformTimeline.EstimateMemoryUsage(recordingDuration, recordingInterval));
                }
                else
                {
                    return(0);
                }
            }
        }
        /// <summary>
        /// Estimate the memory usage in bytes from the storage of snapshots for the current recording duration and interval. 
        /// </summary>
        public int EstimateMemoryUsage()
        {
            if (Application.isPlaying)
            {
                if (recorder == null)
                {
                    return 0;
                }

                return recorder.EstimateMemoryUsage();
            }
            else
            {
                var timeline = GetComponent<Timeline>() ?? GetComponentInParent<Timeline>();

                if (!timeline.rewindable)
                {
                    return 0;
                }

                if (GetComponent<Rigidbody>() != null)
                {
                    return RigidbodyTimeline3D.EstimateMemoryUsage(timeline.recordingDuration, recordingInterval);
                }
                else if (GetComponent<Rigidbody2D>() != null)
                {
                    return RigidbodyTimeline2D.EstimateMemoryUsage(timeline.recordingDuration, recordingInterval);
                }
                else if (GetComponent<Transform>() != null)
                {
                    return TransformTimeline.EstimateMemoryUsage(timeline.recordingDuration, recordingInterval);
                }
                else
                {
                    return 0;
                }
            }
        }