Пример #1
0
        public void OnValidate()
        {
            if (interpolatorToAdd != null)
            {
                if (!HasListenerFor(interpolatorToAdd))
                {
                    UnityEditor.Events.UnityEventTools.AddPersistentListener(innerEvent, interpolatorToAdd.Interpolate);
                }

                interpolatorToAdd = null;
            }

            if (interpolatorsToAdd != null)
            {
                foreach (var interpolator in interpolatorsToAdd.GetComponents <Interpolator>())
                {
                    if (HasListenerFor(interpolator))
                    {
                        continue;
                    }

                    UnityEditor.Events.UnityEventTools.AddPersistentListener(innerEvent, interpolator.Interpolate);
                }

                interpolatorsToAdd = null;
            }

            int persistentListenerIndex = persistentEventCount;

            while (persistentListenerIndex < innerEvent.GetPersistentEventCount())
            {
                innerEvent.SetPersistentListenerState(persistentListenerIndex, UnityEventCallState.EditorAndRuntime);

                persistentListenerIndex++;
            }

            persistentEventCount = innerEvent.GetPersistentEventCount();
        }