public static async Task LogAnyDiffToNewGeneratedUi(this Dictionary <string, FieldView> self, Type modelType, JsonSchemaToView generator, bool forceAlwaysDelete) { GameObject generatedUi = await generator.GenerateViewFrom(modelType, keepReferenceToEditorPrefab : true); generatedUi.name = "Delete me"; if (!LogAnyDiffToNewFieldViews(self, generatedUi.GetFieldViewMap()) || forceAlwaysDelete) { generatedUi.Destroy(); // If there are no additions in the new UI it can be destroyed right away again after logging is done } }
/// <summary> Can be used to generate a view directly from a model, if the json schema does not have to be customized, e.g. /// because the model uses Annotations this is the easiest way to generate a fully usable UI from any class </summary> /// <typeparam name="T"> The type of the model </typeparam> /// <param name="keepReferenceToEditorPrefab"> If the view is generated during editor time this should be set to /// true so that the used prefabs in the view are still linked correctly. </param> /// <returns> The generated view which can be used to load a model instance into it </returns> public static async Task <GameObject> GenerateViewFrom <T>(this JsonSchemaToView self, bool keepReferenceToEditorPrefab = false) { return(await self.GenerateViewFrom(typeof(T), keepReferenceToEditorPrefab)); }