예제 #1
0
        static GameObject GetBoundGameObject(TrackAsset parent, PlayableDirector associatedDirector)
        {
            if (parent == null || parent.Equals(null) || associatedDirector == null)
            {
                return(null);
            }

            var binding = associatedDirector.GetGenericBinding(parent);

            // We are the markerTrack and user did not set a binding, assume it's bound to PlayableDirector
            if (parent.timelineAsset.markerTrack == parent && binding == null)
            {
                return(associatedDirector.gameObject);
            }

            if (binding == null || binding.Equals(null))
            {
                return(null);
            }

            var boundGameObject = binding as GameObject;

            if (boundGameObject == null)
            {
                var boundComponent = binding as Component;
                if (boundComponent != null)
                {
                    boundGameObject = boundComponent.gameObject;
                }
            }

            return(boundGameObject);
        }