private void AddScriptAutomatically(string className) { AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); Type generatedClass = ClassesInformation.GetGeneratedScriptClassByName(className); GameObject placeHolder = new GameObject("Scripts"); placeHolder.AddComponent(generatedClass); }
private void OnGUIContextClassSelection() { GUILayout.FlexibleSpace(); GUILayout.Label("Select context class: "); this._scrollPosContext = EditorGUILayout.BeginScrollView(this._scrollPosContext, GUILayout.Width(this.position.width - 20), GUILayout.Height(150)); foreach (var contextType in _contextTypes) { if (GUILayout.Button(contextType.Name)) { this._selectedContextType = contextType; } } EditorGUILayout.EndScrollView(); if (this._selectedContextType != null) { GUILayout.Label("Select entity class: "); } this._scrollPosEntity = EditorGUILayout.BeginScrollView(this._scrollPosEntity, GUILayout.Width(this.position.width - 20), GUILayout.Height(150)); if (this._selectedContextType != null) { foreach (var entityClass in ClassesInformation.GetEntitiesOfContext(this._selectedContextType)) { if (GUILayout.Button(entityClass.PropertyType.GetGenericArguments()[0].Name)) { this._selectedEntityType = entityClass.PropertyType.GetGenericArguments()[0]; var properties = new List <PropertyInfo>(this._selectedEntityType.GetProperties()); this._propertyQuestions = new Dictionary <PropertyInfo, QuestionType>(); foreach (var publicProperty in properties) { this._propertyQuestions.Add(publicProperty, QuestionType.Empty); } this._currentWindow = Window.PropertyMapping; } } } EditorGUILayout.EndScrollView(); GUILayout.FlexibleSpace(); }