Skip to content

Commit aa1aec3

Browse files
authored
Merge pull request #136 from nothingTVatYT/master
get rid of duplicate variable in generated model example
2 parents fd5b7ea + bb07f8d commit aa1aec3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

manual/graphics/models/generate-model.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,27 @@ private void UpdateMesh(Mesh mesh)
4848
### 3. Create a model asset and model actor in the `OnStart` function
4949

5050
```cs
51-
private Model _tempModel;
51+
private Model _model;
5252

5353
public MaterialBase Material;
5454

5555
public override void OnStart()
5656
{
57-
// Create dynamic model with a single LOD with one mesh
58-
var model = Content.CreateVirtualAsset<Model>();
59-
_tempModel = model;
60-
model.SetupLODs(new[] { 1 });
61-
UpdateMesh(model.LODs[0].Meshes[0]);
57+
// Create dynamic model with a single LOD with one mesh
58+
_model = Content.CreateVirtualAsset<Model>();
59+
_model.SetupLODs(new[] { 1 });
60+
UpdateMesh(_model.LODs[0].Meshes[0]);
6261

63-
// Create or reuse child model
62+
// Create or reuse child model
6463
var childModel = Actor.GetOrAddChild<StaticModel>();
65-
childModel.Model = model;
64+
childModel.Model = _model;
6665
childModel.LocalScale = new Float3(100);
6766
childModel.SetMaterial(0, Material);
6867
}
6968

7069
public override void OnDestroy()
7170
{
72-
FlaxEngine.Object.Destroy(ref _tempModel);
71+
FlaxEngine.Object.Destroy(ref _model);
7372
}
7473
```
7574

0 commit comments

Comments
 (0)