3.0.0-preview.16
# [3.0.0-preview.16](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.15...v3.0.0-preview.16) (2020-08-12)
### Bug Fixes
* texture sheet animation module Sprite mode not working ([30d1d5d](30d1d5d3cc
)), closes [#79](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/79)
pull/120/head
parent
7355c2ac78
commit
f2034e27b7
|
@ -1,3 +1,10 @@
|
|||
# [3.0.0-preview.16](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.15...v3.0.0-preview.16) (2020-08-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* texture sheet animation module Sprite mode not working ([30d1d5d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/30d1d5d3cc67234a8cd985e98f181aff2a8bd8ef)), closes [#79](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/79)
|
||||
|
||||
# [3.0.0-preview.15](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.14...v3.0.0-preview.15) (2020-08-11)
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!687078895 &4343727234628468602
|
||||
SpriteAtlas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: UIParticle_Demo
|
||||
m_EditorData:
|
||||
serializedVersion: 2
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
anisoLevel: 1
|
||||
compressionQuality: 50
|
||||
maxTextureSize: 2048
|
||||
textureCompression: 0
|
||||
filterMode: 1
|
||||
generateMipMaps: 0
|
||||
readable: 0
|
||||
crunchedCompression: 0
|
||||
sRGB: 1
|
||||
platformSettings: []
|
||||
packingSettings:
|
||||
serializedVersion: 2
|
||||
padding: 4
|
||||
blockOffset: 1
|
||||
allowAlphaSplitting: 0
|
||||
enableRotation: 1
|
||||
enableTightPacking: 1
|
||||
variantMultiplier: 1
|
||||
packables:
|
||||
- {fileID: 2800000, guid: 077b84be6d052c34d933c79ef500be13, type: 3}
|
||||
- {fileID: 2800000, guid: 925f66fdcc9764b579413b7408c718f2, type: 3}
|
||||
totalSpriteSurfaceArea: 39725
|
||||
bindAsDefault: 1
|
||||
m_MasterAtlas: {fileID: 0}
|
||||
m_PackedSprites:
|
||||
- {fileID: 21300000, guid: 925f66fdcc9764b579413b7408c718f2, type: 3}
|
||||
- {fileID: 21300000, guid: 077b84be6d052c34d933c79ef500be13, type: 3}
|
||||
m_PackedSpriteNamesToIndex:
|
||||
- Unity-chan
|
||||
- Light_Frame
|
||||
m_Tag: UIParticle_Demo
|
||||
m_IsVariant: 0
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f4c242a0c8414734aaa4019486b8695
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4343727234628468602
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
After Width: | Height: | Size: 143 KiB |
|
@ -0,0 +1,185 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 975570a90d56c477682e12d440dc9931
|
||||
timeCreated: 1528964000
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName:
|
||||
21300000: old_detail
|
||||
21300002: old_fast
|
||||
21300004: old_medium
|
||||
21300006: UIEffect_Demo_Dark_Silhouette
|
||||
21300008: UIEffect_Demo_Pattern
|
||||
21300010: UIEffect_Demo_red
|
||||
21300012: UIEffect_Demo_Unity-chan
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 0
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 2
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: old_detail
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 192
|
||||
width: 106
|
||||
height: 159
|
||||
alignment: 0
|
||||
pivot: {x: 53, y: 79.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
- serializedVersion: 2
|
||||
name: old_fast
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 116
|
||||
y: 125
|
||||
width: 106
|
||||
height: 159
|
||||
alignment: 0
|
||||
pivot: {x: 53, y: 79.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
- serializedVersion: 2
|
||||
name: old_medium
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 116
|
||||
y: 288
|
||||
width: 106
|
||||
height: 159
|
||||
alignment: 0
|
||||
pivot: {x: 53, y: 79.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
- serializedVersion: 2
|
||||
name: UIEffect_Demo_Dark_Silhouette
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 116
|
||||
y: 0
|
||||
width: 140
|
||||
height: 121
|
||||
alignment: 0
|
||||
pivot: {x: 70, y: 60.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
- serializedVersion: 2
|
||||
name: UIEffect_Demo_red
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 355
|
||||
width: 100
|
||||
height: 100
|
||||
alignment: 0
|
||||
pivot: {x: 50, y: 50}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
- serializedVersion: 2
|
||||
name: UIEffect_Demo_Unity-chan
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 112
|
||||
height: 188
|
||||
alignment: 0
|
||||
pivot: {x: 56, y: 94}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
tessellationDetail: -1
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bd4122f9f192447a996f8385d6b1fa87
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
|
@ -0,0 +1,57 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 491a59b2ce6484c78ad599da4bf608c5
|
||||
timeCreated: 1488188399
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 0
|
||||
aniso: 16
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 8
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -68,23 +68,22 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
var p = sp.GetArrayElementAtIndex(i);
|
||||
var name = p.FindPropertyRelative("m_Name").stringValue;
|
||||
var type = (ShaderPropertyType)p.FindPropertyRelative("m_Type").intValue;
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() { name = name, type = type }, false);
|
||||
var type = (ShaderPropertyType) p.FindPropertyRelative("m_Type").intValue;
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() {name = name, type = type}, false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ShaderUtil.GetPropertyCount(mat.shader); i++)
|
||||
{
|
||||
var pName = ShaderUtil.GetPropertyName(mat.shader, i);
|
||||
var type = (ShaderPropertyType)ShaderUtil.GetPropertyType(mat.shader, i);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() { name = pName, type = type }, true);
|
||||
var type = (ShaderPropertyType) ShaderUtil.GetPropertyType(mat.shader, i);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() {name = pName, type = type}, true);
|
||||
|
||||
if (type == ShaderPropertyType.Texture)
|
||||
{
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() { name = pName + "_ST", type = ShaderPropertyType.Vector }, true);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() { name = pName + "_HDR", type = ShaderPropertyType.Vector }, true);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() { name = pName + "_TexelSize", type = ShaderPropertyType.Vector }, true);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() {name = pName + "_ST", type = ShaderPropertyType.Vector}, true);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() {name = pName + "_HDR", type = ShaderPropertyType.Vector}, true);
|
||||
AddMenu(gm, sp, new AnimatedPropertiesEditor() {name = pName + "_TexelSize", type = ShaderPropertyType.Vector}, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
gm.ShowAsContext();
|
||||
|
@ -97,21 +96,22 @@ namespace Coffee.UIExtensions
|
|||
return;
|
||||
|
||||
menu.AddItem(new GUIContent(string.Format("{0} ({1})", property.name, property.type)), s_ActiveNames.Contains(property.name), () =>
|
||||
{
|
||||
var index = s_ActiveNames.IndexOf(property.name);
|
||||
if (0 <= index)
|
||||
{
|
||||
sp.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
sp.InsertArrayElementAtIndex(sp.arraySize);
|
||||
var p = sp.GetArrayElementAtIndex(sp.arraySize - 1);
|
||||
p.FindPropertyRelative("m_Name").stringValue = property.name;
|
||||
p.FindPropertyRelative("m_Type").intValue = (int)property.type;
|
||||
}
|
||||
sp.serializedObject.ApplyModifiedProperties();
|
||||
});
|
||||
var index = s_ActiveNames.IndexOf(property.name);
|
||||
if (0 <= index)
|
||||
{
|
||||
sp.DeleteArrayElementAtIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
sp.InsertArrayElementAtIndex(sp.arraySize);
|
||||
var p = sp.GetArrayElementAtIndex(sp.arraySize - 1);
|
||||
p.FindPropertyRelative("m_Name").stringValue = property.name;
|
||||
p.FindPropertyRelative("m_Type").intValue = (int) property.type;
|
||||
}
|
||||
|
||||
sp.serializedObject.ApplyModifiedProperties();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,6 +191,7 @@ namespace Coffee.UIExtensions
|
|||
EditorGUILayout.HelpBox("UIParticles disable the RendererModule in ParticleSystem at runtime to prevent double rendering.", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
|
@ -221,9 +222,11 @@ namespace Coffee.UIExtensions
|
|||
p.gameObject.AddComponent<UIParticle>();
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
s_ParticleSystems.Clear();
|
||||
|
||||
if (current.maskable && current.material && current.material.shader)
|
||||
|
@ -270,7 +273,7 @@ namespace Coffee.UIExtensions
|
|||
|
||||
_particles
|
||||
.Distinct()
|
||||
.Select(x => new { canvas = x.canvas, ps = x.cachedParticleSystem, scale = x.scale })
|
||||
.Select(x => new {canvas = x.canvas, ps = x.cachedParticleSystem, scale = x.scale})
|
||||
.Where(x => x.ps && x.canvas)
|
||||
.ToList()
|
||||
.ForEach(x =>
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace Coffee.UIExtensions
|
|||
if (Directory.Exists(samplePath))
|
||||
return samplePath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -37,8 +38,8 @@ namespace Coffee.UIExtensions
|
|||
if (!string.IsNullOrEmpty(previous))
|
||||
{
|
||||
string msg = "A different version of the sample is already imported at\n\n"
|
||||
+ previous
|
||||
+ "\n\nIt will be deleted when you update. Are you sure you want to continue?";
|
||||
+ previous
|
||||
+ "\n\nIt will be deleted when you update. Are you sure you want to continue?";
|
||||
if (!EditorUtility.DisplayDialog("Sample Importer", msg, "OK", "Cancel"))
|
||||
return;
|
||||
|
||||
|
@ -58,4 +59,4 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY.
|
||||
#endif // [ASMDEFEX] DO NOT REMOVE THIS LINE MANUALLY.
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Profiling;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.UI;
|
||||
using ShaderPropertyType = Coffee.UIExtensions.UIParticle.AnimatableProperty.ShaderPropertyType;
|
||||
#if UNITY_EDITOR
|
||||
using System.Reflection;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
|
@ -29,18 +30,22 @@ namespace Coffee.UIExtensions
|
|||
//################################
|
||||
// Serialize Members.
|
||||
//################################
|
||||
[Tooltip("The ParticleSystem rendered by CanvasRenderer")]
|
||||
[SerializeField] ParticleSystem m_ParticleSystem;
|
||||
[Tooltip("The UIParticle to render trail effect")]
|
||||
[SerializeField] UIParticle m_TrailParticle;
|
||||
[HideInInspector] [SerializeField] bool m_IsTrail = false;
|
||||
[Tooltip("Particle effect scale")]
|
||||
[SerializeField] float m_Scale = 1;
|
||||
[Tooltip("Ignore parent scale")]
|
||||
[SerializeField] bool m_IgnoreParent = false;
|
||||
[Tooltip("The ParticleSystem rendered by CanvasRenderer")] [SerializeField]
|
||||
ParticleSystem m_ParticleSystem;
|
||||
|
||||
[Tooltip("Animatable material properties. AnimationでParticleSystemのマテリアルプロパティを変更する場合、有効にしてください。")]
|
||||
[SerializeField] AnimatableProperty[] m_AnimatableProperties = new AnimatableProperty[0];
|
||||
[Tooltip("The UIParticle to render trail effect")] [SerializeField]
|
||||
UIParticle m_TrailParticle;
|
||||
|
||||
[HideInInspector] [SerializeField] bool m_IsTrail = false;
|
||||
|
||||
[Tooltip("Particle effect scale")] [SerializeField]
|
||||
float m_Scale = 1;
|
||||
|
||||
[Tooltip("Ignore parent scale")] [SerializeField]
|
||||
bool m_IgnoreParent = false;
|
||||
|
||||
[Tooltip("Animatable material properties. AnimationでParticleSystemのマテリアルプロパティを変更する場合、有効にしてください。")] [SerializeField]
|
||||
AnimatableProperty[] m_AnimatableProperties = new AnimatableProperty[0];
|
||||
|
||||
static MaterialPropertyBlock s_Mpb;
|
||||
|
||||
|
@ -56,12 +61,14 @@ namespace Coffee.UIExtensions
|
|||
Texture,
|
||||
};
|
||||
|
||||
[SerializeField]
|
||||
string m_Name = "";
|
||||
[SerializeField]
|
||||
ShaderPropertyType m_Type = ShaderPropertyType.Vector;
|
||||
[SerializeField] string m_Name = "";
|
||||
[SerializeField] ShaderPropertyType m_Type = ShaderPropertyType.Vector;
|
||||
public int id { get; private set; }
|
||||
public ShaderPropertyType type { get { return m_Type; } }
|
||||
|
||||
public ShaderPropertyType type
|
||||
{
|
||||
get { return m_Type; }
|
||||
}
|
||||
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
|
@ -75,7 +82,6 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
|
||||
|
||||
|
||||
//################################
|
||||
// Public/Protected Members.
|
||||
//################################
|
||||
|
@ -90,12 +96,12 @@ namespace Coffee.UIExtensions
|
|||
var textureSheet = cachedParticleSystem.textureSheetAnimation;
|
||||
if (textureSheet.enabled && textureSheet.mode == ParticleSystemAnimationMode.Sprites && 0 < textureSheet.spriteCount)
|
||||
{
|
||||
var sprite = textureSheet.GetSprite(0);
|
||||
textureSheet.uvChannelMask = (UVChannelFlags) (sprite && sprite.packed ? -1 : 0);
|
||||
tex = sprite ? sprite.texture : null;
|
||||
tex = GetActualTexture(textureSheet.GetSprite(0));
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
if (!tex && _renderer)
|
||||
{
|
||||
Profiler.BeginSample("Check material");
|
||||
|
@ -104,8 +110,10 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
tex = mat.mainTexture;
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
return tex ?? s_WhiteTexture;
|
||||
}
|
||||
}
|
||||
|
@ -115,10 +123,10 @@ namespace Coffee.UIExtensions
|
|||
get
|
||||
{
|
||||
return _renderer
|
||||
? m_IsTrail
|
||||
? _renderer.trailMaterial
|
||||
: _renderer.sharedMaterial
|
||||
: null;
|
||||
? m_IsTrail
|
||||
? _renderer.trailMaterial
|
||||
: _renderer.sharedMaterial
|
||||
: null;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -142,7 +150,11 @@ namespace Coffee.UIExtensions
|
|||
/// <summary>
|
||||
/// Particle effect scale.
|
||||
/// </summary>
|
||||
public float scale { get { return _parent ? _parent.scale : m_Scale; } set { m_Scale = value; } }
|
||||
public float scale
|
||||
{
|
||||
get { return _parent ? _parent.scale : m_Scale; }
|
||||
set { m_Scale = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should the soft mask ignore parent soft masks?
|
||||
|
@ -172,12 +184,19 @@ namespace Coffee.UIExtensions
|
|||
/// <summary>
|
||||
/// Should this graphic be considered a target for raycasting?
|
||||
/// </summary>
|
||||
public override bool raycastTarget { get { return false; } set { base.raycastTarget = value; } }
|
||||
public override bool raycastTarget
|
||||
{
|
||||
get { return false; }
|
||||
set { base.raycastTarget = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ParticleSystem.
|
||||
/// </summary>
|
||||
public ParticleSystem cachedParticleSystem { get { return m_ParticleSystem ? m_ParticleSystem : (m_ParticleSystem = GetComponent<ParticleSystem>()); } }
|
||||
public ParticleSystem cachedParticleSystem
|
||||
{
|
||||
get { return m_ParticleSystem ? m_ParticleSystem : (m_ParticleSystem = GetComponent<ParticleSystem>()); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform material modification in this function.
|
||||
|
@ -208,6 +227,7 @@ namespace Coffee.UIExtensions
|
|||
Canvas.willRenderCanvases += UpdateMeshes;
|
||||
s_Mpb = new MaterialPropertyBlock();
|
||||
}
|
||||
|
||||
s_ActiveParticles.Add(this);
|
||||
|
||||
// Reset the parent-child relation.
|
||||
|
@ -216,6 +236,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
s_TempRelatables[i].OnTransformParentChanged();
|
||||
}
|
||||
|
||||
s_TempRelatables.Clear();
|
||||
|
||||
_renderer = cachedParticleSystem ? cachedParticleSystem.GetComponent<ParticleSystemRenderer>() : null;
|
||||
|
@ -256,6 +277,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
_children[i].SetParent(_parent);
|
||||
}
|
||||
|
||||
_children.Clear();
|
||||
SetParent(null);
|
||||
|
||||
|
@ -278,6 +300,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
cachedParticleSystem.GetComponent<ParticleSystemRenderer>().enabled = false;
|
||||
}
|
||||
|
||||
base.Reset();
|
||||
}
|
||||
#endif
|
||||
|
@ -304,6 +327,7 @@ namespace Coffee.UIExtensions
|
|||
parentTransform = parentTransform.parent;
|
||||
}
|
||||
}
|
||||
|
||||
SetParent(newParent);
|
||||
|
||||
base.OnTransformParentChanged();
|
||||
|
@ -383,6 +407,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
_renderer.enabled = false;
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
|
||||
// #69: Editor crashes when mesh is set to null when ParticleSystem.RenderMode=Mesh
|
||||
|
@ -396,8 +421,8 @@ namespace Coffee.UIExtensions
|
|||
Profiler.BeginSample("Make Matrix");
|
||||
ParticleSystem.MainModule main = m_ParticleSystem.main;
|
||||
scaleaMatrix = main.scalingMode == ParticleSystemScalingMode.Hierarchy
|
||||
? Matrix4x4.Scale(scale * Vector3.one)
|
||||
: Matrix4x4.Scale(scale * rootCanvas.transform.localScale);
|
||||
? Matrix4x4.Scale(scale * Vector3.one)
|
||||
: Matrix4x4.Scale(scale * rootCanvas.transform.localScale);
|
||||
Matrix4x4 matrix = default(Matrix4x4);
|
||||
switch (main.simulationSpace)
|
||||
{
|
||||
|
@ -444,12 +469,15 @@ namespace Coffee.UIExtensions
|
|||
p.position = p.position + delta;
|
||||
s_Particles[i] = p;
|
||||
}
|
||||
|
||||
m_ParticleSystem.SetParticles(s_Particles, count);
|
||||
}
|
||||
|
||||
break;
|
||||
case ParticleSystemSimulationSpace.Custom:
|
||||
break;
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
|
||||
_mesh.Clear();
|
||||
|
@ -465,6 +493,7 @@ namespace Coffee.UIExtensions
|
|||
Profiler.EndSample();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_IsTrail)
|
||||
{
|
||||
_renderer.BakeTrailsMesh(_mesh, cam, true);
|
||||
|
@ -473,6 +502,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
_renderer.BakeMesh(_mesh, cam, true);
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
|
||||
// Apply matrix.
|
||||
|
@ -484,8 +514,9 @@ namespace Coffee.UIExtensions
|
|||
var count_c = s_Colors.Count;
|
||||
for (int i = 0; i < count_c; i++)
|
||||
{
|
||||
s_Colors[i] = ((Color)s_Colors[i]).gamma;
|
||||
s_Colors[i] = ((Color) s_Colors[i]).gamma;
|
||||
}
|
||||
|
||||
_mesh.SetColors(s_Colors);
|
||||
}
|
||||
|
||||
|
@ -495,6 +526,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
s_Vertices[i] = matrix.MultiplyPoint3x4(s_Vertices[i]);
|
||||
}
|
||||
|
||||
_mesh.SetVertices(s_Vertices);
|
||||
_mesh.RecalculateBounds();
|
||||
s_Vertices.Clear();
|
||||
|
@ -540,6 +572,7 @@ namespace Coffee.UIExtensions
|
|||
m_TrailParticle.m_ParticleSystem = GetComponent<ParticleSystem>();
|
||||
m_TrailParticle.m_IsTrail = true;
|
||||
}
|
||||
|
||||
m_TrailParticle.enabled = true;
|
||||
}
|
||||
else if (m_TrailParticle)
|
||||
|
@ -561,6 +594,7 @@ namespace Coffee.UIExtensions
|
|||
_parent._children.Remove(this);
|
||||
_parent._children.RemoveAll(x => x == null);
|
||||
}
|
||||
|
||||
_parent = newParent;
|
||||
}
|
||||
|
||||
|
@ -607,5 +641,24 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private static MethodInfo miGetActiveAtlasTexture = typeof(UnityEditor.Experimental.U2D.SpriteEditorExtension)
|
||||
.GetMethod("GetActiveAtlasTexture", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
static Texture2D GetActualTexture(Sprite sprite)
|
||||
{
|
||||
if (!sprite) return null;
|
||||
|
||||
if (Application.isPlaying) return sprite.texture;
|
||||
var ret = miGetActiveAtlasTexture.Invoke(null, new[] {sprite}) as Texture2D;
|
||||
return ret ? ret : sprite.texture;
|
||||
}
|
||||
#else
|
||||
static Texture2D GetActualTexture(Sprite sprite)
|
||||
{
|
||||
return sprite ? sprite.texture : null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR
|
||||
using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility;
|
||||
#endif
|
||||
|
@ -10,7 +8,7 @@ namespace Coffee.UIExtensions
|
|||
/// <summary>
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("")]
|
||||
[AddComponentMenu("")]
|
||||
public class UIParticleOverlayCamera : MonoBehaviour
|
||||
{
|
||||
//################################
|
||||
|
@ -42,6 +40,7 @@ namespace Coffee.UIExtensions
|
|||
UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene(go, prefabStage.scene);
|
||||
s_InstanceForPrefabMode = go.AddComponent<UIParticleOverlayCamera>();
|
||||
}
|
||||
|
||||
return s_InstanceForPrefabMode;
|
||||
}
|
||||
#endif
|
||||
|
@ -49,10 +48,12 @@ namespace Coffee.UIExtensions
|
|||
// Find instance in scene, or create new one.
|
||||
if (object.ReferenceEquals(s_Instance, null))
|
||||
{
|
||||
s_Instance = FindObjectOfType<UIParticleOverlayCamera>() ?? new GameObject(typeof(UIParticleOverlayCamera).Name, typeof(UIParticleOverlayCamera)).GetComponent<UIParticleOverlayCamera>();
|
||||
s_Instance = FindObjectOfType<UIParticleOverlayCamera>() ??
|
||||
new GameObject(typeof(UIParticleOverlayCamera).Name, typeof(UIParticleOverlayCamera)).GetComponent<UIParticleOverlayCamera>();
|
||||
s_Instance.gameObject.SetActive(true);
|
||||
s_Instance.enabled = true;
|
||||
}
|
||||
|
||||
return s_Instance;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +80,11 @@ namespace Coffee.UIExtensions
|
|||
//################################
|
||||
// Private Members.
|
||||
//################################
|
||||
Camera cameraForOvrelay { get { return m_Camera ? m_Camera : (m_Camera = GetComponent<Camera>()) ? m_Camera : (m_Camera = gameObject.AddComponent<Camera>()); } }
|
||||
Camera cameraForOvrelay
|
||||
{
|
||||
get { return m_Camera ? m_Camera : (m_Camera = GetComponent<Camera>()) ? m_Camera : (m_Camera = gameObject.AddComponent<Camera>()); }
|
||||
}
|
||||
|
||||
Camera m_Camera;
|
||||
static UIParticleOverlayCamera s_Instance;
|
||||
#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR
|
||||
|
@ -121,6 +126,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -140,7 +146,7 @@ namespace Coffee.UIExtensions
|
|||
{
|
||||
gameObject.hideFlags = HideFlags.HideAndDontSave;
|
||||
gameObject.tag = "EditorOnly";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the MonoBehaviour will be destroyed.
|
||||
|
@ -161,4 +167,4 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.15",
|
||||
"version": "3.0.0-preview.16",
|
||||
"unity": "2018.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue