类上面添加一行 [CreateAssetMenu(fileName = "Bullet", menuName = "New Bullet", order = 1)] 作用在 Assets 文件夹下,鼠标右键,菜单栏中添加一个按钮项,菜单名为 menuName,并执行生成名为 fileName 的脚本,order 为按钮显示顺序 创建ScriptableObject类文件: using System.Collections; using System.Collectio...
类上面添加一行 [CreateAssetMenu(fileName = "Bullet", menuName = "New Bullet", order = 1)] 作用在 Assets 文件夹下,鼠标右键,菜单栏中添加一个按钮项,菜单名为 menuName,并执行生成名为 fileName 的脚本,order 为按钮显示顺序 创建ScriptableObject类文件: using System.Collections; using System.Collectio...
.orderpublic int order ; 描述 Assets/Create 菜单中菜单项的位置。 Did you find this page useful? Please give it a rating: Report a problem on this page版权所有 © 2020 Unity Technologies. Publication 2019.4 教程社区答案知识库论坛Asset Store商标和使用条款法律条款隐私政策Cookie不要出售或分享我...
[CreateAssetMenu(menuName = “MySubMenue/Create XXX “)]: 标记类,可以给project面板下的Create 菜单下新建一个自定义子菜单,用于新建自定义资源 用于ScriptableObject的子类,将这个类(相当于资源文件添加到Asset菜单项中) [CreateAssetMenu(fileName = “Bullet”, menuName = “New Bullet”, order = 1)] ...
[CreateAssetMenu(fileName = "TestScriptObject", menuName = "CustomEditorTutorial/TestScriptObject", order = 0)] public class TestScriptObject : ScriptableObject { public string Name; } 使用CreateAssetMenu的Attribute的作用是使得其可以在Project窗口中右键生成: ...
using UnityEngine; [CreateAssetMenu(menuName = "Variables/Int", order = 1)] public class IntVariableSO : ScriptableObject { public int value; } 然后,你就可以在MB中使用IntVariableSO,你可以像下面这样构建一个类: public class PlayerHealth : MonoBehaviour { public IntVariableSO health; } 虽然...
1、首先我们需要把资源打包成asset,我们需要先创建一个AssetBundleConfig文件,使用该文件来配置我们打包单个资源和打包文件夹资源的路径以及AB名。 usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;[CreateAssetMenu(fileName = "ABconfig",menuName = "Create ABConfig",order = 0)]publicclass...
要使用 ScriptableObject,必须在应用程序的Assets文件夹中创建一个脚本,并使其继承自ScriptableObject类。您可以使用CreateAssetMenu属性,从而使用您的类轻松创建自定义资源。例如: using UnityEngine; [CreateAssetMenu(fileName = "Data", menuName = "ScriptableObjects/SpawnManagerScriptableObject", order = 1)] publi...
将一个ScriptableObject派生类型标记为自动在Assets / Create子菜单中列出,以便可以轻松创建该类型的实例并将其存储为“ .asset”文件。 1. using System.Collections; using System.Collections.Generic; using UnityEngine; [CreateAssetMenu(fileName ="创建资源",menuName ="Tools",order =1)] public class creat...
●CreateAssetMenuAttribute 用于在 Unity 编辑器中为脚本创建自定义资源菜单项。这个特性允许你在 “Assets” 菜单下创建新的自定义资源,例如脚本的实例或配置文件。你可以将 CreateAssetMenuAttribute 特性应用于你的自定义脚本类,以便在 Unity 编辑器中方便地创建新的资源实例。这对于生成自定义配置文件、材质、纹理等...