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

Method Update

Source/Editor/Windows/Assets/PrefabWindow.cs:477–524  ·  view source on GitHub ↗

(float deltaTime)

Source from the content-addressed store, hash-verified

475
476 /// <inheritdoc />
477 public override void Update(float deltaTime)
478 {
479 try
480 {
481 FlaxEngine.Profiler.BeginEvent("PrefabWindow.Update");
482 if (Graph.Main != null)
483 {
484 // Due to fact that actors in prefab editor are only created but not added to gameplay
485 // we have to manually update some data (Level events work only for actors in a gameplay)
486 Update(Graph.Main);
487 }
488
489 base.Update(deltaTime);
490 }
491 catch (Exception ex)
492 {
493 // Info
494 Editor.LogWarning("Error when updating prefab window for " + _asset);
495 Editor.LogWarning(ex);
496
497 // Refresh
498 Deselect();
499 Graph.MainActor = null;
500 _viewport.Prefab = null;
501 if (_asset.IsLoaded)
502 {
503 OnPrefabOpened();
504 }
505 }
506 finally
507 {
508 FlaxEngine.Profiler.EndEvent();
509 }
510
511 // Auto fit
512 if (_focusCamera && _viewport.Task.FrameCount > 1)
513 {
514 _focusCamera = false;
515 Editor.GetActorEditorSphere(_viewport.Instance, out BoundingSphere bounds);
516 _viewport.ViewPosition = bounds.Center - _viewport.ViewDirection * (bounds.Radius * 1.2f);
517 }
518
519 // Auto save
520 if (IsEdited && LiveReload && DateTime.Now - _modifiedTime > LiveReloadTimeout)
521 {
522 Save();
523 }
524 }
525
526 /// <inheritdoc />
527 public override bool UseLayoutData => true;

Callers

nothing calls this directly

Calls 5

GetActorEditorSphereMethod · 0.80
UpdateFunction · 0.50
BeginEventMethod · 0.45
LogWarningMethod · 0.45
EndEventMethod · 0.45

Tested by

no test coverage detected