Esempio n. 1
0
        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 override bool OnAction()
 {
     AddComponentWindow.SendUsabilityAnalyticsEvent(new AddComponentWindow.AnalyticsEventData
     {
         name        = base.name,
         filter      = AddComponentWindow.s_AddComponentWindow.searchString,
         isNewScript = false
     });
     GameObject[] gameObjects = AddComponentWindow.s_AddComponentWindow.m_GameObjects;
     EditorApplication.ExecuteMenuItemOnGameObjects(this.m_MenuPath, gameObjects);
     return(true);
 }
Esempio n. 3
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();
     }
 }