很多时候 许多类 的 格式 都是重复的,比如 从配置文件中映射出来的类。

这个时候写一个 类模板 就很节省时间了。

 

Code

 1     public static string TestPath = "Assets/Test.cs";
 2     public static string TestValue = "\"test\"";
 3     public static string TestCode =
 4 @"
 5 using UnityEngine;
 6 using System;
 7 using System.Text;
 8 using System.Reflection;
 9 using System.Collections;
10 using System.Collections.Generic;
11 using com.kuxiong.battlemodule;
12 using System.Linq;
13 
14 namespace com.kuxiong.battlemodule
15 {
16     public class Test
17     {
18         public string name = " + TestValue + @";
19     }
20 }";
21 
22 
23     [MenuItem("MyTest/Test")]
24     public static void Test()
25     {
26         Debug.Log("Creating Test Vo");
27 
28         System.IO.File.WriteAllText(TestPath, TestCode);
29 
30         AssetDatabase.ImportAsset(TestPath);
31         AssetDatabase.Refresh();
32     }

相关文章:

  • 2022-12-23
  • 2022-01-19
  • 2022-01-03
  • 2022-12-23
  • 2021-07-06
  • 2021-10-17
  • 2021-08-16
  • 2022-01-20
猜你喜欢
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-11-19
相关资源
相似解决方案