Пример #1
0
        public static void InjectFrom_SerializedObject(SerializedObject serializedObject, bool forceInject = false)
        {
            if (EditorApplication.isCompiling || EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            Object target = serializedObject.targetObject;

            if (target == null)
            {
                return;
            }

            if (PrefabUtility.GetPrefabType(target) == PrefabType.Prefab)
            {
                return;
            }

            int hashCode = target.GetHashCode();

            if (forceInject == false && _hashCodes.Contains(hashCode))
            {
                return;
            }

            _hashCodes.Add(hashCode);

            serializedObject.Update();
            CAutoInjector.Inject(serializedObject, target, forceInject);
            serializedObject.ApplyModifiedProperties();
        }
Пример #2
0
 public static void AutoInjection(SerializedObject serializedObject, bool isForceInject = false)
 {
     serializedObject.Update();
     CAutoInjector.Inject(serializedObject, isForceInject);
     serializedObject.ApplyModifiedProperties();
 }