首页 > 技术文章 > unity_实用小技巧(const)

shirln 2017-10-29 11:48 原文

const:声明某个常量字段或常量局部变量。

注意:常量字段和常量局部变量不是变量并且不能修改

利用const管理游戏标签

例如:

 //管理所有标签
    public const string PlayerPrefs= "player";
    public const string enemys = "enemys";
    public const string items = "items";

推荐阅读