﻿## 代码生成

Res Kit 支持代码生成，生成按钮的位置如下所示:
![image.png](https://file.liangxiegame.com/e482f08e-2e8e-4b43-84bf-f32722cc5f5c.png)
点击生成代码即可，生成后结果如下。
![image.png](https://file.liangxiegame.com/0ea13581-4960-4bc8-bbf1-b49a03455271.png)

生成了 QAssets 代码文件，代码内容如下:

```csharp
namespace QAssetBundle
{
  
    public class Testobj_prefab
    {
        public const string BundleName = "testobj_prefab";
        public const string TESTOBJ = "testobj";
    }
    public class Testsprite_png
    {
        public const string BundleName = "testsprite_png";
        public const string TESTSPRITE = "testsprite";
    }
}

```

生成了代码，那么在写资源加载的代码的时候就会爽的飞起，如下图示:
![image.png](https://file.liangxiegame.com/7b8ae854-aafe-49d8-9318-5f7d1190c8cc.png)

图中，给出了资源名字的提示。

这样就不容易出现字符串的拼写错误了。

本文由 QFramework 教程年会员赞助，地址：[https://www.gamepixedu.com/goods/show/55](https://www.gamepixedu.com/goods/show/55)

* QFramework 主页：[qframework.cn](https://qframework.cn)
* QFramework 交流群: 541745166
* QFramework Github 地址: <https://github.com/liangxiegame/qframework>
* QFramework Gitee 地址：<https://gitee.com/liangxiegame/QFramework>