File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -48,28 +48,27 @@ private void UpdateMesh(Mesh mesh)
48
48
### 3. Create a model asset and model actor in the ` OnStart ` function
49
49
50
50
``` cs
51
- private Model _tempModel ;
51
+ private Model _model ;
52
52
53
53
public MaterialBase Material ;
54
54
55
55
public override void OnStart ()
56
56
{
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 ]);
62
61
63
- // Create or reuse child model
62
+ // Create or reuse child model
64
63
var childModel = Actor .GetOrAddChild <StaticModel >();
65
- childModel .Model = model ;
64
+ childModel .Model = _model ;
66
65
childModel .LocalScale = new Float3 (100 );
67
66
childModel .SetMaterial (0 , Material );
68
67
}
69
68
70
69
public override void OnDestroy ()
71
70
{
72
- FlaxEngine .Object .Destroy (ref _tempModel );
71
+ FlaxEngine .Object .Destroy (ref _model );
73
72
}
74
73
```
75
74
You can’t perform that action at this time.
0 commit comments