Exemplo n.º 1
0
 private static void EditorApplication_playModeStateChanged(PlayModeStateChange obj)
 {
     if (obj == PlayModeStateChange.ExitingPlayMode)
     {
         UnityFeatureDefineSymbols.AddSymbolForAllBuildTargets("IS_CANDLELIGHT_HYPERTEXT_AVAILABLE");
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Registers a scene GUI callback for the target object of the supplied editor context.
        /// </summary>
        /// <param name="ctx">Editor for the object whose scene GUI should be drawn.</param>
        /// <param name="action">GUI calback for the object.</param>
        public static void RegisterObjectGUICallback(ISceneGUIContext ctx, System.Action action)
        {
            UnityFeatureDefineSymbols.AddSymbolForAllBuildTargets("IS_CANDLELIGHT_SCENE_GUI_AVAILABLE");

            Object target = ctx.SceneGUIContext.target;

            // don't register same target more than once
            if (s_RegisteredContexts.Count(r => r.Target == target) > 0)
            {
                return;
            }
            // don't register targets of the same type if they're on another object
            System.Type targetType = target.GetType();
            for (int i = 0; i < s_RegisteredContexts.Count; ++i)
            {
                if (targetType == s_RegisteredContexts[i].Target.GetType())
                {
                    if (target is ScriptableObject)
                    {
                        return;
                    }
                    else if (
                        (target as Component).gameObject != (s_RegisteredContexts[i].Target as Component).gameObject
                        )
                    {
                        return;
                    }
                }
            }
            s_RegisteredContexts.Add(
                new RegisteredContext
            {
                Callback = action,
                Context  = ctx.SceneGUIContext,
                Target   = target
            }
                );
        }