Prevent performing default spawn behavior when spawning from a prefab.

This commit is contained in:
Menotdan
2023-12-17 12:02:56 -05:00
parent 9ea5ed79f8
commit ea744ab4ac
5 changed files with 27 additions and 6 deletions

View File

@@ -71,6 +71,11 @@ namespace FlaxEditor.SceneGraph.Actors
{
base.PostSpawn();
if (Actor.HasPrefabLink)
{
return;
}
((BoxCollider)Actor).AutoResize();
}
}

View File

@@ -334,6 +334,11 @@ namespace FlaxEditor.SceneGraph.Actors
{
base.PostSpawn();
if (Actor.HasPrefabLink)
{
return;
}
// Setup for an initial spline
var spline = (Spline)Actor;
spline.AddSplineLocalPoint(Vector3.Zero, false);

View File

@@ -61,14 +61,15 @@ namespace FlaxEditor.SceneGraph.Actors
{
base.PostSpawn();
if (Actor.HasPrefabLink)
{
return;
}
// Setup for default values
var text = (SpriteRender)Actor;
if (!Actor.HasPrefabLink)
{
text.Material = FlaxEngine.Content.LoadAsyncInternal<MaterialBase>(EditorAssets.DefaultSpriteMaterial);
text.Image = FlaxEngine.Content.LoadAsyncInternal<Texture>(EditorAssets.FlaxIconTexture);
}
text.Material = FlaxEngine.Content.LoadAsyncInternal<MaterialBase>(EditorAssets.DefaultSpriteMaterial);
text.Image = FlaxEngine.Content.LoadAsyncInternal<Texture>(EditorAssets.FlaxIconTexture);
}
}
}

View File

@@ -22,6 +22,11 @@ namespace FlaxEditor.SceneGraph.Actors
{
base.PostSpawn();
if (Actor.HasPrefabLink)
{
return;
}
// Setup for default values
var text = (TextRender)Actor;
text.Text = "My Text";

View File

@@ -29,6 +29,11 @@ namespace FlaxEditor.SceneGraph.Actors
{
base.PostSpawn();
if (Actor.HasPrefabLink)
{
return;
}
// Rotate to match the space (GUI uses upper left corner as a root)
Actor.LocalOrientation = Quaternion.Euler(0, -180, -180);
bool canSpawn = true;