using System.Collections; using System.Collections.Generic; using System.Data.SqlTypes; using UnityEngine; [CreateAssetMenu(fileName = "TestScriptObj", menuName = "MyAsset/Test Script Obj")]//添加这个特性就能在资源窗口右键创建资源 public class TestScriptObj : ScriptableObject { public string myname; public string myage; public int ID; public TestClass tc; } [System.Serializable]//标记可序列化 要不然在Inspector 面板看不到这个字段 public class TestClass { public int TestInt; public void testFucn() { List vecArr = new List(); Vector3 tvec; tvec.x = 10; tvec.y = 10; tvec.z = 0; vecArr.Add(tvec); } }