You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 12:10:08 +00:00
@@ -339,6 +339,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
else if (_renderer.CanBakeMesh())
|
||||
{
|
||||
_particleSystem.ValidateShape();
|
||||
#if PS_BAKE_API_V2
|
||||
_renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera,
|
||||
ParticleSystemBakeMeshOptions.BakeRotationAndScale);
|
||||
|
||||
@@ -109,6 +109,29 @@ namespace Coffee.UIParticleExtensions
|
||||
return s_TmpParticles;
|
||||
}
|
||||
|
||||
public static void ValidateShape(this ParticleSystem self)
|
||||
{
|
||||
var shape = self.shape;
|
||||
if (shape.enabled && shape.alignToDirection)
|
||||
{
|
||||
if (Mathf.Approximately(shape.scale.x * shape.scale.y * shape.scale.z, 0))
|
||||
{
|
||||
if (Mathf.Approximately(shape.scale.x, 0))
|
||||
{
|
||||
shape.scale.Set(0.0001f, shape.scale.y, shape.scale.z);
|
||||
}
|
||||
else if (Mathf.Approximately(shape.scale.y, 0))
|
||||
{
|
||||
shape.scale.Set(shape.scale.x, 0.0001f, shape.scale.z);
|
||||
}
|
||||
else if (Mathf.Approximately(shape.scale.z, 0))
|
||||
{
|
||||
shape.scale.Set(shape.scale.x, shape.scale.y, 0.0001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanBakeMesh(this ParticleSystemRenderer self)
|
||||
{
|
||||
// #69: Editor crashes when mesh is set to null when `ParticleSystem.RenderMode = Mesh`
|
||||
|
||||
Reference in New Issue
Block a user