Skip to content

Commit

Permalink
3.0.0-preview.36
Browse files Browse the repository at this point in the history
# [3.0.0-preview.36](v3.0.0-preview.35...v3.0.0-preview.36) (2020-09-28)

### Bug Fixes

* do not bake particle system to mesh when the alpha is zero ([1775713](1775713)), closes [#102](#102)
* in Unity 2018.x, sample import failed on Windows ([f5861b0](f5861b0))
  • Loading branch information
semantic-release-bot committed Sep 28, 2020
1 parent 94ae9d2 commit 4b4d70b
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 125 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# [3.0.0-preview.36](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.35...v3.0.0-preview.36) (2020-09-28)


### Bug Fixes

* do not bake particle system to mesh when the alpha is zero ([1775713](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1775713c2dbeef09ad3eb1f49b53cf44bf61d535)), closes [#102](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/102)
* in Unity 2018.x, sample import failed on Windows ([f5861b0](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/f5861b0add1477987d6b9a3db26979fde50930ad))

# [3.0.0-preview.35](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.34...v3.0.0-preview.35) (2020-09-27)


Expand Down
3 changes: 1 addition & 2 deletions Scripts/AnimatableProperty.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using UnityEngine;
using UnityEngine;

namespace Coffee.UIExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Scripts/BakingCamera.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UnityEngine;

namespace Coffee.UIExtensions
namespace Coffee.UIParticleExtensions
{
internal class BakingCamera : MonoBehaviour
{
Expand Down
5 changes: 2 additions & 3 deletions Scripts/CombineInstanceEx.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;

namespace Coffee.UIExtensions
namespace Coffee.UIParticleExtensions
{
internal class CombineInstanceEx
{
Expand Down
1 change: 0 additions & 1 deletion Scripts/Editor/AnimatedPropertiesEditor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
Expand Down
70 changes: 70 additions & 0 deletions Scripts/Editor/ImportSampleMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#if !UNITY_2019_1_OR_NEWER
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEditor;

static class ImportSampleMenu_UIParticle
{
private const string k_DisplayName = "UI Particle";
private const string k_JsonGuid = "823dc693d087a4b559c7e1547274cc7d";

[MenuItem("Assets/Samples/" + k_DisplayName + "/Import Demo")]
private static void ImportDemo()
{
ImportSample(k_JsonGuid, "Demo");
}

private static void ImportSample(string jsonGuid, string sampleName)
{
var jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid);
var packageRoot = Path.GetDirectoryName(jsonPath).Replace('\\', '/');
var json = File.ReadAllText(jsonPath);
var version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
var src = string.Format("{0}/Samples~/{1}", packageRoot, sampleName);
var dst = string.Format("Assets/Samples/{0}/{1}/{2}", k_DisplayName, version, sampleName);
var previousPath = GetPreviousSamplePath(k_DisplayName, sampleName);

// Remove the previous sample directory.
if (!string.IsNullOrEmpty(previousPath))
{
var msg = "A different version of the sample is already imported at\n\n"
+ previousPath
+ "\n\nIt will be deleted when you update. Are you sure you want to continue?";
if (!EditorUtility.DisplayDialog("Sample Importer", msg, "OK", "Cancel"))
return;

FileUtil.DeleteFileOrDirectory(previousPath);

var metaFile = previousPath + ".meta";
if (File.Exists(metaFile))
FileUtil.DeleteFileOrDirectory(metaFile);
}

if (!Directory.Exists(dst))
FileUtil.DeleteFileOrDirectory(dst);

var dstDir = Path.GetDirectoryName(dst);
if (!Directory.Exists(dstDir))
Directory.CreateDirectory(dstDir);

if (Directory.Exists(src))
FileUtil.CopyFileOrDirectory(src, dst);
else
throw new DirectoryNotFoundException(src);

AssetDatabase.Refresh(ImportAssetOptions.ImportRecursive);
}

private static string GetPreviousSamplePath(string displayName, string sampleName)
{
var sampleRoot = string.Format("Assets/Samples/{0}", displayName);
var sampleRootInfo = new DirectoryInfo(sampleRoot);
if (!sampleRootInfo.Exists) return null;

return sampleRootInfo.GetDirectories()
.Select(versionDir => Path.Combine(versionDir.ToString(), sampleName))
.FirstOrDefault(Directory.Exists);
}
}
#endif
File renamed without changes.
113 changes: 0 additions & 113 deletions Scripts/Editor/UIParticleMenu.cs

This file was deleted.

5 changes: 2 additions & 3 deletions Scripts/MeshHelper.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;

namespace Coffee.UIExtensions
namespace Coffee.UIParticleExtensions
{
internal static class MeshHelper
{
Expand Down
1 change: 1 addition & 0 deletions Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Coffee.UIParticleExtensions;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
Expand Down
5 changes: 5 additions & 0 deletions Scripts/UIParticleUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Coffee.UIParticleExtensions;
using UnityEngine;
using UnityEngine.Profiling;

Expand Down Expand Up @@ -196,6 +197,10 @@ private static void BakeMesh(UIParticle particle)
Profiler.EndSample();
}

// #102: Do not bake particle system to mesh when the alpha is zero.
if (Mathf.Approximately( particle.canvasRenderer.GetInheritedAlpha(), 0))
continue;

// Bake main particles.
var r = currentPs.GetComponent<ParticleSystemRenderer>();
if (CanBakeMesh(r))
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Reflection;
using UnityEngine;

namespace Coffee.UIExtensions
namespace Coffee.UIParticleExtensions
{
internal static class SpriteExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle",
"displayName": "UI Particle",
"description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.",
"version": "3.0.0-preview.35",
"version": "3.0.0-preview.36",
"unity": "2018.2",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 4b4d70b

Please sign in to comment.