I understand that I can iterate through a list of properties with
object.GetType().GetProperties();
However, that doesn’t seem to work here. I’m fairly new to C# and unity, so I know I’m definitely missing something obvious, but anything helps. Thanks!
Class:
public class PlayerPreferences_Audio
{
public float MasterVolume = 1.0f; // Master
public float MusicVolume = 1.0f; // Music
public float PlayerVolume = 1.0f; // Player Noises
}
public class PlayerPreferences
{
public PlayerPreferences_Audio Audio;
public PlayerPreferences()
{
Audio = new PlayerPreferences_Audio();
}
}
Code:
PlayerPreferences testPlayerPreferences = new PlayerPreferences();
Debug.Log(testPlayerPreferences.Audio.MasterVolume);
Debug.Log(testPlayerPreferences.GetType().GetProperties().Length);
Why is it telling me the object has no properties even though I am directly accessing one in that code?