internal void Create(GameObject[] gameObjects)
        {
            if (!CanCreate())
            {
                return;
            }

            CreateScript();

            foreach (var go in gameObjects)
            {
                var script = AssetDatabase.LoadAssetAtPath(TargetPath(), typeof(MonoScript)) as MonoScript;
                script.SetScriptTypeWasJustCreatedFromComponentMenu();
                InternalEditorUtility.AddScriptComponentUncheckedUndoable(go, script);
            }

            AddComponentWindow.SendUsabilityAnalyticsEvent(new AddComponentWindow.AnalyticsEventData
            {
                name        = m_ClassName,
                filter      = AddComponentWindow.s_AddComponentWindow.searchString,
                isNewScript = true
            });

            AddComponentWindow.s_AddComponentWindow.Close();
        }
 public void Create()
 {
     if (!this.CanCreate())
     {
         return;
     }
     this.CreateScript();
     foreach (GameObject gameObject in AddComponentWindow.gameObjects)
     {
         MonoScript script = AssetDatabase.LoadAssetAtPath(this.TargetPath(), typeof(MonoScript)) as MonoScript;
         script.SetScriptTypeWasJustCreatedFromComponentMenu();
         InternalEditorUtility.AddScriptComponentUncheckedUndoable(gameObject, script);
     }
     AddComponentWindow.s_AddComponentWindow.Close();
 }
 public void Create()
 {
     if (this.CanCreate())
     {
         this.CreateScript();
         GameObject[] gameObjects = AddComponentWindow.gameObjects;
         for (int i = 0; i < gameObjects.Length; i++)
         {
             GameObject gameObject = gameObjects[i];
             MonoScript monoScript = AssetDatabase.LoadAssetAtPath(this.TargetPath(), typeof(MonoScript)) as MonoScript;
             monoScript.SetScriptTypeWasJustCreatedFromComponentMenu();
             InternalEditorUtility.AddScriptComponentUncheckedUndoable(gameObject, monoScript);
         }
         AddComponentWindow.s_AddComponentWindow.Close();
     }
 }
예제 #4
0
        internal void Create(GameObject[] gameObjects, string searchString)
        {
            if (!CanCreate())
            {
                return;
            }

            CreateScript();

            foreach (var go in gameObjects)
            {
                var script = AssetDatabase.LoadAssetAtPath(TargetPath(), typeof(MonoScript)) as MonoScript;
                script.SetScriptTypeWasJustCreatedFromComponentMenu();
                InternalEditorUtility.AddScriptComponentUncheckedUndoable(go, script);
            }
        }
예제 #5
0
 private void Create(GameObject[] gameObjects)
 {
     if (this.CanCreate())
     {
         this.CreateScript();
         for (int i = 0; i < gameObjects.Length; i++)
         {
             GameObject gameObject = gameObjects[i];
             MonoScript monoScript = AssetDatabase.LoadAssetAtPath(this.TargetPath(), typeof(MonoScript)) as MonoScript;
             monoScript.SetScriptTypeWasJustCreatedFromComponentMenu();
             InternalEditorUtility.AddScriptComponentUncheckedUndoable(gameObject, monoScript);
         }
         AddComponentWindow.SendUsabilityAnalyticsEvent(new AddComponentWindow.AnalyticsEventData
         {
             name        = this.m_ClassName,
             filter      = AddComponentWindow.s_AddComponentWindow.searchString,
             isNewScript = true
         });
         AddComponentWindow.s_AddComponentWindow.Close();
     }
 }