| 154 | } |
| 155 | |
| 156 | bool GameSettings::Load() |
| 157 | { |
| 158 | PROFILE_CPU(); |
| 159 | |
| 160 | // Load main settings asset |
| 161 | auto settings = Get(); |
| 162 | if (!settings) |
| 163 | { |
| 164 | #if USE_EDITOR |
| 165 | // Allow lack of Game Settings in Editor |
| 166 | return false; |
| 167 | #else |
| 168 | return true; |
| 169 | #endif |
| 170 | } |
| 171 | |
| 172 | // Preload all settings assets |
| 173 | #define PRELOAD_SETTINGS(type) \ |
| 174 | { \ |
| 175 | if (settings->type) \ |
| 176 | { \ |
| 177 | Content::LoadAsync<JsonAsset>(settings->type); \ |
| 178 | } \ |
| 179 | else \ |
| 180 | { \ |
| 181 | LOG(Warning, "Missing {0} settings", TEXT(#type)); \ |
| 182 | } \ |
| 183 | } |
| 184 | PRELOAD_SETTINGS(Time); |
| 185 | PRELOAD_SETTINGS(Audio); |
| 186 | PRELOAD_SETTINGS(LayersAndTags); |
| 187 | PRELOAD_SETTINGS(Physics); |
| 188 | PRELOAD_SETTINGS(Input); |
| 189 | PRELOAD_SETTINGS(Graphics); |
| 190 | PRELOAD_SETTINGS(Network); |
| 191 | PRELOAD_SETTINGS(Navigation); |
| 192 | PRELOAD_SETTINGS(Localization); |
| 193 | PRELOAD_SETTINGS(GameCooking); |
| 194 | PRELOAD_SETTINGS(Streaming); |
| 195 | #undef PRELOAD_SETTINGS |
| 196 | |
| 197 | // Apply the game settings to the engine |
| 198 | settings->Apply(); |
| 199 | |
| 200 | return false; |
| 201 | } |
| 202 | |
| 203 | void GameSettings::Apply() |
| 204 | { |