Skip to content

Commit e16fea0

Browse files
dustindustin
authored andcommitted
added more comments
1 parent cd866f9 commit e16fea0

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Assets/UIController/UIController.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class UIController : MonoBehaviour
4141
public CommandConfigManager configmanager;
4242
public CommandConfig config;
4343
public PostProcessVolume postprocessvolume;
44-
readonly string configmanagerpath = "CommandConfigManager.yaml";
44+
readonly string configmanagerpath = "CommandConfigManager.yaml"; // The file storing serialized CommandConfigManager object
4545

4646
public Toggle host, server, start, pause;
4747
public Dropdown exs;
@@ -60,12 +60,15 @@ public class UIController : MonoBehaviour
6060
public ConditionTestPanel ctpanel;
6161

6262
/* Awake() -----------------------------------------------------------------------------
63-
Description: Awake is called when the script instance is being loaded see the following
64-
URL for more information: https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html
65-
----------------------------------------------------------------------------------------*/
63+
Description: Awake is called when the script instance is being loaded. Awake is called only
64+
a single time. See the following URL for more information:
65+
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html
6666
67+
Loads a configmanger object from the configmanager path, then loads the config object.
68+
----------------------------------------------------------------------------------------*/
6769
void Awake()
6870
{
71+
// Check for CommandConfigManager.yaml existance
6972
if (File.Exists(configmanagerpath))
7073
{
7174
configmanager = configmanagerpath.ReadYamlFile<CommandConfigManager>();
@@ -75,15 +78,26 @@ void Awake()
7578
configmanager = new CommandConfigManager();
7679
}
7780

81+
// Load the config file if there is a path in configmanager
7882
if (configmanager.AutoLoadSaveLastConfig)
7983
{
8084
config = LoadConfig(configmanager.LastConfigFilePath);
8185
}
8286
}
8387

88+
/* LoadConfig() -----------------------------------------------------------------------------
89+
Description: Loads in and returns a CommandConfig object from configfilepath. Creates A new
90+
config object if it can't be loaded
91+
92+
Parameters:
93+
configfilepath - The config file path to the CommandConfig object
94+
otherwisedefault - create a new CommandConfig object to use instead.
95+
----------------------------------------------------------------------------------------*/
8496
public CommandConfig LoadConfig(string configfilepath, bool otherwisedefault = true)
8597
{
8698
CommandConfig cfg = null;
99+
100+
// Check if the file exists at the specified path, if so, load it.
87101
if (File.Exists(configfilepath))
88102
{
89103
cfg = configfilepath.ReadYamlFile<CommandConfig>();

0 commit comments

Comments
 (0)