Skip to content

Commit

Permalink
fix: nullReferenceException after copy-n-paste
Browse files Browse the repository at this point in the history
close #258
  • Loading branch information
mob-sakai committed Aug 14, 2023
1 parent bd43e8c commit 24730d3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Scripts/UIParticleRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ public override Material GetModifiedMaterial(Material baseMaterial)
{
_currentMaterialForRendering = null;

if (!IsActive()) return baseMaterial;
if (!IsActive() || !_parent)
{
ModifiedMaterial.Remove(_modifiedMaterial);
_modifiedMaterial = null;
return baseMaterial;
}

var modifiedMaterial = base.GetModifiedMaterial(baseMaterial);

Expand Down Expand Up @@ -157,6 +162,12 @@ public void Reset(int index = -1)
_lastBounds = new Bounds();
enabled = false;
}
else
{
ModifiedMaterial.Remove(_modifiedMaterial);
_modifiedMaterial = null;
_currentMaterialForRendering = null;
}
}

public void Set(UIParticle parent, ParticleSystem particleSystem, bool isTrail)
Expand Down

0 comments on commit 24730d3

Please sign in to comment.