Fix crash when changing prefab root object

This commit is contained in:
Wojtek Figat
2021-02-04 22:59:13 +01:00
parent ae785267c2
commit db55f5ea3f

View File

@@ -72,7 +72,28 @@ namespace FlaxEditor.Viewport.Previews
public Actor Instance
{
get => _instance;
internal set => _instance = value;
internal set
{
if (_instance == value)
return;
if (_instance)
{
if (customControlLinked != null)
{
customControlLinked.Parent = null;
customControlLinked = null;
}
Task.RemoveCustomActor(_instance);
}
_instance = value;
if (_instance)
{
Task.AddCustomActor(_instance);
}
}
}
/// <summary>