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(); }
protected override void OnEnable() { base.OnEnable(); dataSource = new AddComponentDataSource(); gui = new AddComponentGUI(dataSource); s_AddComponentWindow = this; m_Search = EditorPrefs.GetString(kComponentSearch, ""); showHeader = true; }
internal static bool Show(Rect rect, GameObject[] gos) { CloseAllOpenWindows <AddComponentWindow>(); Event.current.Use(); s_AddComponentWindow = CreateAndInit <AddComponentWindow>(rect); s_AddComponentWindow.m_GameObjects = gos; s_AddComponentWindow.m_ComponentOpenTime = DateTime.UtcNow; return(true); }
public override bool OnAction() { AddComponentWindow.SendUsabilityAnalyticsEvent(new AddComponentWindow.AnalyticsEventData { name = name, filter = AddComponentWindow.s_AddComponentWindow.searchString, isNewScript = false }); var gos = AddComponentWindow.s_AddComponentWindow.m_GameObjects; EditorApplication.ExecuteMenuItemOnGameObjects(m_MenuPath, gos); return(true); }
protected override void OnDisable() { s_AddComponentWindow = null; EditorPrefs.SetString(kComponentSearch, m_Search); }