MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Init

Method Init

Source/Editor/Editor.cs:263–364  ·  view source on GitHub ↗
(StartupFlags flags, Guid startupScene)

Source from the content-addressed store, hash-verified

261 }
262
263 internal void Init(StartupFlags flags, Guid startupScene)
264 {
265 Log("Setting up C# Editor...");
266 _isHeadlessMode = flags.HasFlag(StartupFlags.Headless);
267 _autoExit = flags.HasFlag(StartupFlags.Exit);
268 _startupSceneCmdLine = startupScene;
269
270 Profiler.BeginEvent("Projects");
271 EngineProject = ProjectInfo.Load(StringUtils.CombinePaths(Globals.StartupFolder, "Flax.flaxproj"));
272 GameProject = ProjectInfo.Load(Internal_GetProjectPath());
273 Profiler.EndEvent();
274
275 Profiler.BeginEvent("Icons");
276 Icons = new EditorIcons();
277 Icons.LoadIcons();
278 Profiler.EndEvent();
279
280 // Create common editor modules
281 Profiler.BeginEvent("Modules");
282 RegisterModule(Options = new OptionsModule(this));
283 RegisterModule(ProjectCache = new ProjectCacheModule(this));
284 RegisterModule(Scene = new SceneModule(this));
285 RegisterModule(Windows = new WindowsModule(this));
286 RegisterModule(UI = new UIModule(this));
287 RegisterModule(Thumbnails = new ThumbnailsModule(this));
288 RegisterModule(Simulation = new SimulationModule(this));
289 RegisterModule(Prefabs = new PrefabsModule(this));
290 RegisterModule(SceneEditing = new SceneEditingModule(this));
291 RegisterModule(ContentEditing = new ContentEditingModule(this));
292 RegisterModule(ContentDatabase = new ContentDatabaseModule(this));
293 RegisterModule(ContentImporting = new ContentImportingModule(this));
294 RegisterModule(CodeEditing = new CodeEditingModule(this));
295 RegisterModule(CodeDocs = new CodeDocsModule(this));
296 RegisterModule(ProgressReporting = new ProgressReportingModule(this));
297 RegisterModule(ContentFinding = new ContentFindingModule(this));
298 Profiler.EndEvent();
299
300 StateMachine = new EditorStateMachine(this);
301 Undo = new EditorUndo(this);
302
303 if (flags.HasFlag(StartupFlags.NewProject))
304 InitProject();
305 EnsureState<LoadingState>();
306 Log("Editor init");
307 if (_isHeadlessMode)
308 Log("Running in headless mode");
309
310 // Note: we don't sort modules before Init (optimized)
311 _modules.Sort((a, b) => a.InitOrder - b.InitOrder);
312 _isAfterInit = true;
313
314 // Initialize modules (from front to back)
315 for (int i = 0; i < _modules.Count; i++)
316 {
317 var module = _modules[i];
318 Profiler.BeginEvent(module.GetType().Name);
319 module.OnInit();
320 Profiler.EndEvent();

Callers

nothing calls this directly

Calls 14

HasFlagMethod · 0.80
CombinePathsMethod · 0.80
LoadIconsMethod · 0.80
HasCustomDataMethod · 0.80
ParseIDMethod · 0.80
TryGetCustomDataMethod · 0.80
StartInitEndingMethod · 0.80
LogFunction · 0.50
BeginEventMethod · 0.45
LoadMethod · 0.45
EndEventMethod · 0.45
SortMethod · 0.45

Tested by

no test coverage detected