fix: nullReferenceException after copy-n-paste

close #258
pull/289/head
mob-sakai 2023-08-14 15:47:07 +09:00
parent 8b4ca1add5
commit 425aad0cba
1 changed files with 12 additions and 1 deletions

View File

@ -112,7 +112,12 @@ namespace Coffee.UIExtensions
{
_currentMaterialForRendering = null;
if (!IsActive()) return baseMaterial;
if (!IsActive() || !_parent)
{
ModifiedMaterial.Remove(_modifiedMaterial);
_modifiedMaterial = null;
return baseMaterial;
}
var modifiedMaterial = base.GetModifiedMaterial(baseMaterial);
@ -157,6 +162,12 @@ namespace Coffee.UIExtensions
_lastBounds = new Bounds();
enabled = false;
}
else
{
ModifiedMaterial.Remove(_modifiedMaterial);
_modifiedMaterial = null;
_currentMaterialForRendering = null;
}
}
public void Set(UIParticle parent, ParticleSystem particleSystem, bool isTrail)