mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-06-11 05:54:07 +00:00
Destroy materials and properties when MPC is destroyed
This commit is contained in:
parent
2592f15c4c
commit
e6372b2703
|
@ -99,6 +99,15 @@ namespace ConformalDecals.MaterialModifiers {
|
||||||
_materialProperties ??= new Dictionary<string, MaterialProperty>();
|
_materialProperties ??= new Dictionary<string, MaterialProperty>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnDestroy() {
|
||||||
|
if (_decalMaterial != null) Destroy(_decalMaterial);
|
||||||
|
if (_previewMaterial != null) Destroy(_previewMaterial);
|
||||||
|
|
||||||
|
foreach (var entry in _materialProperties) {
|
||||||
|
Destroy(entry.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddProperty(MaterialProperty property) {
|
public void AddProperty(MaterialProperty property) {
|
||||||
if (property == null) throw new ArgumentNullException(nameof(property));
|
if (property == null) throw new ArgumentNullException(nameof(property));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user