private void loadSpecificStoryData() { string path = "Assets/Data/" + storyToLoad + ".asset"; if (!AssetDatabase.LoadAssetAtPath <StoryData>(path)) { path = "Assets/Data/Story.asset"; } StoryData data = StoryData.LoadData(path); SerializedObject dataObj = new SerializedObject(data); SerializedProperty beatList = dataObj.FindProperty("_beats"); EditorGUILayout.BeginVertical(); _scroll = EditorGUILayout.BeginScrollView(_scroll); if (_view == View.Beat && _currentIndex != -1) { OnGUI_BeatView(beatList, _currentIndex); } else { OnGUI_ListView(beatList); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); dataObj.ApplyModifiedProperties(); }
//sets up gui void OnGUI() { StoryData data = StoryData.LoadData(); //Get story data from editor SerializedObject dataObj = new SerializedObject(data); //turn data in to an object SerializedProperty beatList = dataObj.FindProperty("beats"); //get beats //note* look up editor api EditorGUILayout.BeginVertical(); scroll = EditorGUILayout.BeginScrollView(scroll); if (view == View.Beat && currentIndex != -1) { OnGUI_BeatView(beatList, currentIndex); } else { OnGUI_ListView(beatList); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); dataObj.ApplyModifiedProperties(); }
void OnGUI() { StoryData data = StoryData.LoadData(); SerializedObject dataObj = new SerializedObject(data); SerializedProperty beatList = dataObj.FindProperty("_beats"); EditorGUILayout.BeginVertical(); _scroll = EditorGUILayout.BeginScrollView(_scroll); if (_view == View.Beat && _currentIndex != -1) { OnGUI_BeatView(beatList, _currentIndex); } else { OnGUI_ListView(beatList); } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); dataObj.ApplyModifiedProperties(); }
// Start is called before the first frame update void Start() { Application.targetFrameRate = FPS; storyData.LoadData(); StartGame(1); }