浏览代码

Fix/LocationSO not serialized properly (#258)

* Fix GameSceneSO not serialized properly.

* Add a reference to the script as a ObjectField in the GameSceneSO

To edit the code faster

* Fix typo
/main
GitHub 4 年前
当前提交
76062a54
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 11
      UOP1_Project/Assets/Scripts/Editor/GameSceneSOEditor.cs

11
UOP1_Project/Assets/Scripts/Editor/GameSceneSOEditor.cs


{
private const string NO_SCENES_WARNING = "There is no Scene associated to this location yet. Add a new scene with the dropdown below";
private GUIStyle _headerLabelStyle;
private static readonly string[] _excludedProperties = { "m_Script", "sceneName" };
private static readonly string[] _excludedProperties = { "m_Script", "sceneName" }; //m_script is a reference to the script being edited but it'll result an editable object field.
private string[] _sceneList;
private GameSceneSO _gameSceneInspected;

public override void OnInspectorGUI()
{
//Make GUI not editable.
GUI.enabled = false;
//Draw reference information about script being edited.
EditorGUILayout.ObjectField("Script", MonoScript.FromScriptableObject((GameSceneSO)target), typeof(GameSceneSO), false);
//Make GUI editable.
GUI.enabled = true;
serializedObject.Update();
serializedObject.ApplyModifiedProperties();
}
private void DrawScenePicker()

正在加载...
取消
保存