示例#1
0
        public static void AddTypewriterText(MenuCommand menuCommand)
        {
            // Replicates the creation of a Unity Text component and copy all the properties but m_Script
            // into the TypewriterText component
            GameObject       go             = DialogEditorUtils.MenuOptions_AddText(menuCommand);
            Text             comp           = go.GetComponent <Text>();
            SerializedObject compSerialized = new SerializedObject(comp);

            DestroyImmediate(comp);
            comp = go.AddComponent <TypewriterText>();
            SerializedObject   newCompSerialized = new SerializedObject(comp);
            SerializedProperty prop = compSerialized.GetIterator();

            while (prop.NextVisible(true))
            {
                if (!prop.name.Equals("m_Script"))
                {
                    newCompSerialized.CopyFromSerializedProperty(prop);
                    Debug.Log(prop.propertyPath + " " + prop.name);
                }
            }
            newCompSerialized.ApplyModifiedProperties();
        }
示例#2
0
 public static ConversationAsset CreateAsset()
 {
     return(DialogEditorUtils.CreateAssetInSelectedDirectory <ConversationAsset>());
 }
示例#3
0
 public static void AddConversationTrigger()
 {
     DialogEditorUtils.CreateGameObjectWithComponent <ConversationTrigger>();
 }