我们创建一个C#脚本然后做点修改: [CreateAssetMenu(fileName = "##创建Scriptable Obj时候默认的名字",menuName = "##右键菜单里的路径,比如Make a Bullet/Bullet")]//方便从菜单快速创建子弹副本publicclassBullets:ScriptableObject{publicfloatbulletSp
Scriptable Object没有继承自MonoBehavior,而是继承自Scriptable Object,所以Scriptable Object不能当脚本挂载到GameObject上,也不能进行GetComponent等对GameObject的操作,同时Scriptable Object以Asset文件存储,但不论是MonoBehavior还是Scriptable Object最终都继承自Unity Object。 但要注意的是,虽然Scriptable Object没有继承自Mo...
{ publicstringMyString; } 此时我们可以批量创建多个类型相同,但是内容不同的 scriptable object, 用于记录数据(用来记录grid大小以及特点),也可以用来制作编辑器工具(如 URP 资源文件)。 可用来接解决资源,比如每种敌人都有武器,如果每个武器都有数据,如果有大量敌人,那么数据就会被大量复制。如果武器数据是 scriptabl...
使用新的编辑器框架——UI Toolket(UI Elements),我们可以以前端的方式快速编写美观的编辑器插件了,不需要其他插件的支持。我们可以为一种类型的Scriptable Object指定一个编辑器,只需要选中那个文件,就可以使用对应的编辑器进行编辑。 创建基本数据的Scriptable Object 这步声明数据的储存格式,只需要新建一个类,继承自...
OnDestroy This function is called when the scriptable object will be destroyed. OnDisable This function is called when the scriptable object goes out of scope. OnEnable This function is called when the object is loaded. OnValidate Editor-only function that Unity calls when the script is loaded ...
Just like MonoBehaviours, ScriptableObjects derive from the baseUnityEngine.Objectbut, unlike MonoBehaviours, you can’t attach a ScriptableObject to aGameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s function...
默认是支持使用Scriptable Object进行配置的版本,视频中有展示如何使用git回退到最初的简单版本。代码很简单,添加了注释,很简单就能看懂。如有帮助,麻烦给个三连,谢谢~ gitee地址: https://gitee.com/stdio_o/unity-bottom-bar科技 计算机技术 游戏开发 C# 编程 教程 unity ...
Create new scriptable object asset. Rename. Duplicate. Delete. Select in inspector. Find asset location. Find asset references in the current scene. Generate new data editor window. Generate and store the type of SO that can be edited. Disable specific actions like 'Create/Delete' for SO of ...
开始实现之前,首先简单介绍该音频库模块,音频库类Audio Database继承自Scriptable Object类,是一个可配置的资源文件: 包含的内容如下,databaseName表示该音频库的名称,outputAudioMixerGroup表示音频播放时的输出混音器组,datasets则是表示所有音频数据的列表: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 /// ...
ShaderVariantCollection变体收集 ShaderVariantCollection可以在防止着色器被编译时出现性能尖峰。 shadervariantcollection允许你保存游戏中使用的着色器变量列表作为资产。它是通过选择“Create -> Shader -> Shader Variant”创建的集合”。 从已创建的ShaderVariantCollection的Inspector视图中,按Add Shader添加目标着色器,然后...