void GenerateObjects() { if (_prefab == null) { AltoLog.Warn("Please select generate target object."); return; } if (_parent == _prefab) { AltoLog.Warn("Parent object and Target object should be different."); return; } int numX = Math.Min(Math.Max((int)_generateNum.x, 1), MaxNum); int numY = Math.Min(Math.Max((int)_generateNum.y, 1), MaxNum); int numZ = Math.Min(Math.Max((int)_generateNum.z, 1), MaxNum); var genInfo = new List <GenerateInfo>(); for (int z = 0; z < numZ; ++z) { for (int y = 0; y < numY; ++y) { for (int x = 0; x < numX; ++x) { genInfo.Add(MakeGenerateInfo(x, y, z)); } } } AltoLog.Info($"Generate { genInfo.Count } objects ..."); PreprocessGenerateInfo(genInfo); DoGenerate(genInfo); }
static void ImportCsv( string csvPath, string dataName, string dataPath, Func <string, Type> dataTypeGetter ) { AltoLog.Info($"Master data csv update detected : { csvPath }"); string destDataPath = $"{ dataPath }{ dataName }.asset"; var data = AssetDatabase.LoadMainAssetAtPath(destDataPath); if (data == null) { AltoLog.Error($"Master data ScriptableObject not exist : { destDataPath }"); return; } var type = dataTypeGetter(dataName); if (type == null) { AltoLog.Error($"Type reflection failed : { dataName }"); return; } MethodInfo method = type.GetMethod("Import"); if (method == null) { AltoLog.Error($"Method reflection failed"); return; } var csvLines = LoadCsvFile(csvPath); method.Invoke(data, new object[] { csvLines }); EditorUtility.SetDirty(data); AssetDatabase.SaveAssets(); AltoLog.Success($"Master data import succeeded : { dataName }"); }