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(); } }
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(); } }