Skip to content

Commit

Permalink
Fix terrain from code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
mafiesto4 committed May 2, 2024
1 parent 0ac6009 commit ac363b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion manual/terrain/tutorials/terrain-from-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class TerrainFromCode : Script
_terrain.HideFlags = HideFlags.DontSave;
_terrain.Name = "My Terrain";
_terrain.Setup();
_terrain.Parent = Actor;

// Generate terrain using the async task to prevent game stalls
// You can also use C# thread to perform this work
Expand Down Expand Up @@ -66,6 +65,9 @@ public class TerrainFromCode : Script
_terrain.SetupPatchHeightMap(ref patchCoord, heightmap, null, true);
}
}

// Spawn terrain to the scene on a main-thread (safe)
Scripting.InvokeOnUpdate(() => _terrain.Parent = Actor);
}
}
```
Expand Down

0 comments on commit ac363b0

Please sign in to comment.