"ShowObject Window",true);// 直接根据ScriptableObject构造一个Editorwindow.editor=Editor.CreateEditor(ScriptableObject.CreateInstance<ShowObject>());}privatevoidOnGUI(){// 直接调用Inspector的绘制显示this.editor
来自Unity官方开发者电子书《Create modular game architecture in unity with scriptableobjects》 前言 在unity官方文档的 Advanced best practice guides 中,提供了多本电子书,其中都包含许多有价值的信息。 本文将《Create modular game architecture in unity with scriptableobjects》翻译为中文版本供有需要的小伙伴参考...
class in UnityEditor / Inherits from:ScriptableObject Leave feedback Description Derive from this base class to create a custom inspector or editor for your custom object. using UnityEngine; using System.Collections; // This is not an editor script. public class MyPlayer :MonoBehaviour{ public int...
总结:在编辑器模式下,我们可以将数据保存到ScriptableObject里(当创建一个脚本化对象实例后使用AssetDatabase.CreateAsset()保存成资源),因为是作为本地资源保存的,所以在退出之后也不会丢失。 但只有在编辑器模式下才可以修改里面的数据,这是因为ScriptableObject对象虽然声明在UnityEngine中,但是它的Scriptable是通过Unity...
1、实例化 ScriptableObject.CreateInstance 2、生成资源文件 AssetDatabase.CreateAsset 3、加载资源文件 AssetDatabase.LoadAssetAtPath 补充:如何在编辑器中直接显示ScriptableObject的OnInspectorGUI。 ```Csharp if (editor==null) //这一步很重要,如果没有设置,那么就不会显示 ...
class in UnityEditor / Inherits from:ScriptableObject Leave feedback Description Derive from this class to create a custom Editor window. Use this class to create Editor windows that can either float independently or dock as tabs, similar to the default windows in the Unity Editor. ...
最后,检查对话条目节点的OnExecute()事件,单击“+”按钮,并分配TestScriptableObject。选择你想要执行的方法(PlayAudioClip),并指定你想要播放的音频剪辑的索引: Outline Editor 大纲编辑器 你也可以在大纲模式下编辑对话,如上图所示,这对像Bioware的Aurora工具集这样的编辑器的用户来说可能更熟悉。要切换到大纲模式...
对于游戏数据比如武器、成就等,可使用ScriptableObjects在编辑器中进行有效组织。如下代码所示: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 using UnityEngine;publicclassNewBehaviourScript:ScriptableObject{publicstring ItemName;publicint ItemLevel;publicTexture2D ItemIcon;} ...
// StateMachineEditor.csusing UnityEngine; using UnityEditor; [CustomEditor(typeof(StateMachine))] publicclassStateMachineEditor:Editor { public overridevoidOnEnable(){} public overridevoidOnInspectorGUI(){ base.OnInspectorGUI(); } } OnEnable()函数将在每次查看对应的Inspector时被调用,故可用来初始化编...
if (GUILayout.Button("Create/Update XML")) { CreateXml(XmlName); } 1. 2. 3. 4. 随后打开窗口即可看到 输入数据并点击按钮生成文件 打开XML文件查看数据 创建Asset数据用于保存XML数据 新建脚本XmlAsset.cs,继承自ScriptableObject,同样放置在Editor文件夹下 AI检测代码解析 public class XmlAsset : Scriptabl...