/*Auto Create, Don't Edit !!!*/ using UnityEngine; using System.Collections.Generic; using System; using System.IO; [Serializable] public class edgesnapsecondDataExcelItem : ExcelItemBase { public float detectiontime; public string name; public int position; } [CreateAssetMenu(fileName = "edgesnapsecondDataExcelData", menuName = "Excel To ScriptableObject/Create edgesnapsecondDataExcelData", order = 1)] public class edgesnapsecondDataExcelData : ExcelDataBase { } #if UNITY_EDITOR public class edgesnapsecondDataAssetAssignment { public static bool CreateAsset(List> allItemValueRowList, string excelAssetPath) { if (allItemValueRowList == null || allItemValueRowList.Count == 0) return false; int rowCount = allItemValueRowList.Count; edgesnapsecondDataExcelItem[] items = new edgesnapsecondDataExcelItem[rowCount]; for (int i = 0; i < items.Length; i++) { items[i] = new edgesnapsecondDataExcelItem(); items[i].detectiontime = Convert.ToSingle(allItemValueRowList[i]["detectiontime"]); items[i].name = allItemValueRowList[i]["name"]; items[i].position = Convert.ToInt32(allItemValueRowList[i]["position"]); } edgesnapsecondDataExcelData excelDataAsset = ScriptableObject.CreateInstance(); excelDataAsset.items = items; if (!Directory.Exists(excelAssetPath)) Directory.CreateDirectory(excelAssetPath); string pullPath = excelAssetPath + "/" + typeof(edgesnapsecondDataExcelData).Name + ".asset"; UnityEditor.AssetDatabase.DeleteAsset(pullPath); UnityEditor.AssetDatabase.CreateAsset(excelDataAsset, pullPath); UnityEditor.AssetDatabase.Refresh(); return true; } } #endif