예제 #1
0
    /// <summary>
    /// Initializes the Word-Behaviour when it is drag-dropped into the scene
    /// </summary>
    public void OnEnable()
    {
        var behaviour = (WordBehaviour)target;

        // We don't want to initialize if this is a prefab.
        if (QCARUtilities.GetPrefabType(behaviour) == PrefabType.Prefab)
        {
            return;
        }

        // Initialize scene manager
        if (!SceneManager.Instance.SceneInitialized)
        {
            SceneManager.Instance.InitScene();
        }

        IEditorWordBehaviour editorBehaviour = behaviour;

        if (!editorBehaviour.InitializedInEditor && !EditorApplication.isPlaying)
        {
            //default values
            editorBehaviour.SetMode(WordTemplateMode.Template);
            editorBehaviour.SetSpecificWord("Word");

            //define appearance
            UpdateMesh(behaviour);

            editorBehaviour.SetInitializedInEditor(true);

            // Inform Unity that the behaviour properties have changed.
            EditorUtility.SetDirty(behaviour);
        }
    }
예제 #2
0
    public void OnEnable()
    {
        WordAbstractBehaviour target = (WordAbstractBehaviour)base.target;

        if (QCARUtilities.GetPrefabType(target) != PrefabType.Prefab)
        {
            if (!SceneManager.Instance.SceneInitialized)
            {
                SceneManager.Instance.InitScene();
            }
            IEditorWordBehaviour behaviour2 = target;
            if (!behaviour2.InitializedInEditor && !EditorApplication.isPlaying)
            {
                behaviour2.SetMode(WordTemplateMode.Template);
                behaviour2.SetSpecificWord("Word");
                UpdateMesh(target);
                behaviour2.SetInitializedInEditor(true);
                EditorUtility.SetDirty(target);
            }
        }
    }