release v1.3.0

pull/33/head
mob-sakai 2018-12-21 22:58:28 +09:00
commit 657962af6f
20 changed files with 22392 additions and 4463 deletions

View File

@ -3300,11 +3300,26 @@ PrefabInstance:
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 199250511257377142, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 356b9d0e2cad849c3b53c7e9e1680cb7, type: 2}
- target: {fileID: 199250511257377142, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 356b9d0e2cad849c3b53c7e9e1680cb7, type: 2}
- target: {fileID: 199894620351742168, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 199894620351742168, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 57cef6c0f7570214991e091275f08894, type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5d682dd3e44264ff69bd02590123ea73, type: 3}
--- !u!224 &603288243 stripped
@ -3455,6 +3470,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 203308585}
m_Modifications:
- target: {fileID: 1682573490798784, guid: 5d682dd3e44264ff69bd02590123ea73, type: 3}
propertyPath: m_Name
value: UIParticle_Demo_Effect_Root
objectReference: {fileID: 0}
- target: {fileID: 224024702899216688, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_LocalPosition.x
@ -3495,6 +3514,21 @@ PrefabInstance:
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224024702899216688, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224024702899216688, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224024702899216688, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224024702899216688, guid: 5d682dd3e44264ff69bd02590123ea73,
type: 3}
propertyPath: m_AnchoredPosition.x
@ -5371,7 +5405,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: << ParticleEffectForUGUI v1.2.0 >>
m_Text: << ParticleEffectForUGUI v1.3.0 >>
--- !u!222 &1359744117
CanvasRenderer:
m_ObjectHideFlags: 0

View File

@ -5,7 +5,8 @@ Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UIParticle_Demo_FireExplosion
m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON _EMISSION _FADING_ON _REQUIRE_UV2

View File

@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UIParticle_Demo_Fire_Additive
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: df33a97a787f8a64a82b59ee073e7cd7, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5a8a71c22a6f24028aeb0f5961cddeb4
timeCreated: 1494793998
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -436,6 +436,135 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 98366915}
m_PrefabAsset: {fileID: 0}
--- !u!1 &117797991
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 117797992}
- component: {fileID: 117797995}
- component: {fileID: 117797994}
- component: {fileID: 117797993}
m_Layer: 5
m_Name: Button (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &117797992
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 117797991}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2109999200}
m_Father: {fileID: 543674874}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 65.6, y: 0}
m_SizeDelta: {x: 65.1, y: 30}
m_Pivot: {x: 0, y: 0}
--- !u!114 &117797993
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 117797991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 117797994}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1494285119}
m_MethodName: LoadScene
m_Mode: 5
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument: UIParticle_Demo_ScaleTest2
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &117797994
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 117797991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!222 &117797995
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 117797991}
m_CullTransparentMesh: 0
--- !u!1 &144671041
GameObject:
m_ObjectHideFlags: 0
@ -1683,6 +1812,7 @@ RectTransform:
- {fileID: 2065407674}
- {fileID: 1441804502}
- {fileID: 2118461833}
- {fileID: 117797992}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -3616,6 +3746,92 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 615979679}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1540312607
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1540312610}
- component: {fileID: 1540312609}
- component: {fileID: 1540312608}
m_Layer: 0
m_Name: UIParticleOverlayCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!20 &1540312608
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540312607}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 300
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &1540312609
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540312607}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f69dfb25b53b14addbd71dbebdbaa132, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1540312610
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540312607}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 200, y: 300, z: -100}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1560911276
GameObject:
m_ObjectHideFlags: 0
@ -4486,6 +4702,85 @@ RectTransform:
m_AnchoredPosition: {x: -5, y: 0}
m_SizeDelta: {x: -20, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2109999199
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2109999200}
- component: {fileID: 2109999202}
- component: {fileID: 2109999201}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2109999200
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2109999199}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 117797992}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2109999201
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2109999199}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Test2
--- !u!222 &2109999202
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2109999199}
m_CullTransparentMesh: 0
--- !u!1 &2118461832
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 712b3f963876343cebf8429fee2f2b57
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 40d8f2504d16f42d7a0422e7397e5f86
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UIParticle_Demo_Spread_Additive
m_Shader: {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 66c6abb38948941d8b179d7b99d3270f
timeCreated: 1494793998
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,9 @@ using UnityEditor.UI;
using UnityEngine;
using System.Collections.Generic;
using System.Linq;
using UnityEditor.IMGUI.Controls;
using System;
using System.Reflection;
namespace Coffee.UIExtensions
{
@ -13,9 +16,15 @@ namespace Coffee.UIExtensions
//################################
// Constant or Static Members.
//################################
static readonly GUIContent contentParticleMaterial = new GUIContent ("Particle Material", "The material for rendering particles");
static readonly GUIContent contentTrailMaterial = new GUIContent ("Trail Material", "The material for rendering particle trails");
static readonly GUIContent s_ContentParticleMaterial = new GUIContent ("Particle Material", "The material for rendering particles");
static readonly GUIContent s_ContentTrailMaterial = new GUIContent ("Trail Material", "The material for rendering particle trails");
static readonly List<ParticleSystem> s_ParticleSystems = new List<ParticleSystem> ();
static readonly Matrix4x4 s_ArcHandleOffsetMatrix = Matrix4x4.TRS (Vector3.zero, Quaternion.AngleAxis (90f, Vector3.right) * Quaternion.AngleAxis (90f, Vector3.up), Vector3.one);
static readonly Dictionary<string, MethodInfo> s_InternalMethods = new Dictionary<string, MethodInfo> ();
static readonly Color s_GizmoColor = new Color (1f, 0.7f, 0.7f, 0.9f);
static readonly Color s_ShapeGizmoThicknessTint = new Color (0.7f, 0.7f, 0.7f, 1.0f);
static Material s_Material;
//################################
// Public/Protected Members.
@ -30,6 +39,13 @@ namespace Coffee.UIExtensions
_spTrailParticle = serializedObject.FindProperty ("m_TrailParticle");
_spScale = serializedObject.FindProperty ("m_Scale");
_spIgnoreParent = serializedObject.FindProperty ("m_IgnoreParent");
if (!s_Material)
{
s_Material = Call<Material> (typeof (Material), "GetDefaultMaterial");
}
_particles = targets.Cast<UIParticle> ().ToArray ();
}
/// <summary>
@ -47,8 +63,8 @@ namespace Coffee.UIExtensions
var pr = ps.GetComponent<ParticleSystemRenderer> ();
var sp = new SerializedObject (pr).FindProperty ("m_Materials");
EditorGUILayout.PropertyField (sp.GetArrayElementAtIndex (0), contentParticleMaterial);
EditorGUILayout.PropertyField (sp.GetArrayElementAtIndex (1), contentTrailMaterial);
EditorGUILayout.PropertyField (sp.GetArrayElementAtIndex (0), s_ContentParticleMaterial);
EditorGUILayout.PropertyField (sp.GetArrayElementAtIndex (1), s_ContentTrailMaterial);
sp.serializedObject.ApplyModifiedProperties ();
if (!Application.isPlaying && pr.enabled)
@ -98,5 +114,403 @@ namespace Coffee.UIExtensions
SerializedProperty _spTrailParticle;
SerializedProperty _spScale;
SerializedProperty _spIgnoreParent;
UIParticle [] _particles;
ArcHandle _arcHandle = new ArcHandle ();
BoxBoundsHandle _boxBoundsHandle = new BoxBoundsHandle ();
SphereBoundsHandle _sphereBoundsHandle = new SphereBoundsHandle ();
Mesh _spriteMesh;
static T Call<T> (Type type, string method, params object [] args)
{
MethodInfo mi;
if (!s_InternalMethods.TryGetValue (method, out mi))
{
mi = type.GetMethod (method, BindingFlags.Static | BindingFlags.NonPublic);
s_InternalMethods.Add (method, mi);
}
return (T)mi.Invoke (null, args);
}
void OnSceneGUI ()
{
Color origCol = Handles.color;
Handles.color = s_GizmoColor;
Matrix4x4 orgMatrix = Handles.matrix;
EditorGUI.BeginChangeCheck ();
foreach (UIParticle current in _particles)
{
ParticleSystem ps = current.GetComponent<ParticleSystem> ();
if (!ps)
{
continue;
}
var shapeModule = ps.shape;
var mainModule = ps.main;
ParticleSystemShapeType type = shapeModule.shapeType;
Matrix4x4 transformMatrix = new Matrix4x4 ();
if (mainModule.scalingMode == ParticleSystemScalingMode.Local)
{
transformMatrix.SetTRS (ps.transform.position, ps.transform.rotation, ps.transform.localScale);
}
else if (mainModule.scalingMode == ParticleSystemScalingMode.Hierarchy)
{
transformMatrix = ps.transform.localToWorldMatrix;
}
else
{
transformMatrix.SetTRS (ps.transform.position, ps.transform.rotation, ps.transform.lossyScale);
}
bool isBox = (type == ParticleSystemShapeType.Box || type == ParticleSystemShapeType.BoxShell || type == ParticleSystemShapeType.BoxEdge || type == ParticleSystemShapeType.Rectangle);
Vector3 emitterScale = isBox ? Vector3.one : shapeModule.scale;
Matrix4x4 emitterMatrix = Matrix4x4.TRS (shapeModule.position, Quaternion.Euler (shapeModule.rotation), emitterScale);
transformMatrix *= emitterMatrix;
Handles.matrix = transformMatrix;
if(current.canvas.renderMode == RenderMode.ScreenSpaceOverlay || ps.main.scalingMode == ParticleSystemScalingMode.Hierarchy)
{
Handles.matrix = Handles.matrix * Matrix4x4.Scale (Vector3.one * current.scale);
}
else
{
Handles.matrix = Handles.matrix * Matrix4x4.Scale (current.canvas.rootCanvas.transform.localScale * current.scale);
}
if (type == ParticleSystemShapeType.Sphere)
{
// Thickness
Handles.color *= s_ShapeGizmoThicknessTint;
EditorGUI.BeginChangeCheck ();
//float radiusThickness = Handles.DoSimpleRadiusHandle (Quaternion.identity, Vector3.zero, shapeModule.radius * (1.0f - shapeModule.radiusThickness), false, shapeModule.arc);
float radiusThickness = Call<float> (typeof (Handles), "DoSimpleRadiusHandle", Quaternion.identity, Vector3.zero, shapeModule.radius * (1.0f - shapeModule.radiusThickness), false, shapeModule.arc);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Sphere Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (radiusThickness / shapeModule.radius);
}
// Sphere
Handles.color = s_GizmoColor;
EditorGUI.BeginChangeCheck ();
//float radius = Handles.DoSimpleRadiusHandle (Quaternion.identity, Vector3.zero, shapeModule.radius, false, shapeModule.arc);
float radius = Call<float> (typeof (Handles), "DoSimpleRadiusHandle", Quaternion.identity, Vector3.zero, shapeModule.radius, false, shapeModule.arc);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Sphere Handle Change");
shapeModule.radius = radius;
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3.one * shapeModule.radius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_SphereMesh, false, s_SphereTextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.Circle)
{
// Thickness
EditorGUI.BeginChangeCheck ();
_arcHandle.angle = shapeModule.arc;
_arcHandle.radius = shapeModule.radius * (1.0f - shapeModule.radiusThickness);
_arcHandle.SetColorWithRadiusHandle (s_ShapeGizmoThicknessTint, 0f);
_arcHandle.angleHandleColor = Color.clear;
using (new Handles.DrawingScope (Handles.matrix * s_ArcHandleOffsetMatrix))
_arcHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Circle Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (_arcHandle.radius / shapeModule.radius);
}
// Circle
EditorGUI.BeginChangeCheck ();
_arcHandle.radius = shapeModule.radius;
_arcHandle.SetColorWithRadiusHandle (Color.white, 0f);
using (new Handles.DrawingScope (Handles.matrix * s_ArcHandleOffsetMatrix))
_arcHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Circle Handle Change");
shapeModule.radius = _arcHandle.radius;
shapeModule.arc = _arcHandle.angle;
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (Vector3.zero, Quaternion.Euler (90.0f, 0.0f, 180.0f), Vector3.one * shapeModule.radius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_CircleMesh, true, s_TextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.Hemisphere)
{
// Thickness
Handles.color *= s_ShapeGizmoThicknessTint;
EditorGUI.BeginChangeCheck ();
//float radiusThickness = Handles.DoSimpleRadiusHandle (Quaternion.identity, Vector3.zero, shapeModule.radius * (1.0f - shapeModule.radiusThickness), true, shapeModule.arc);
float radiusThickness = Call<float> (typeof (Handles), "DoSimpleRadiusHandle", Quaternion.identity, Vector3.zero, shapeModule.radius * (1.0f - shapeModule.radiusThickness), true, shapeModule.arc);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Hemisphere Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (radiusThickness / shapeModule.radius);
}
// Hemisphere
Handles.color = s_GizmoColor;
EditorGUI.BeginChangeCheck ();
//float radius = Handles.DoSimpleRadiusHandle (Quaternion.identity, Vector3.zero, shapeModule.radius, true, shapeModule.arc);
float radius = Call<float> (typeof (Handles), "DoSimpleRadiusHandle", Quaternion.identity, Vector3.zero, shapeModule.radius, true, shapeModule.arc);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Hemisphere Handle Change");
shapeModule.radius = radius;
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (Vector3.zero, Quaternion.identity, Vector3.one * shapeModule.radius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_HemisphereMesh, false, s_SphereTextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.Cone)
{
// Thickness
Handles.color *= s_ShapeGizmoThicknessTint;
EditorGUI.BeginChangeCheck ();
float angleThickness = Mathf.Lerp (shapeModule.angle, 0.0f, shapeModule.radiusThickness);
Vector3 radiusThicknessAngleRange = new Vector3 (shapeModule.radius * (1.0f - shapeModule.radiusThickness), angleThickness, mainModule.startSpeedMultiplier);
//radiusThicknessAngleRange = Handles.ConeFrustrumHandle (Quaternion.identity, Vector3.zero, radiusThicknessAngleRange, Handles.ConeHandles.Radius);
radiusThicknessAngleRange = Call<Vector3> (typeof (Handles), "ConeFrustrumHandle", Quaternion.identity, Vector3.zero, radiusThicknessAngleRange, 1);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Cone Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (radiusThicknessAngleRange.x / shapeModule.radius);
}
// Cone
Handles.color = s_GizmoColor;
EditorGUI.BeginChangeCheck ();
Vector3 radiusAngleRange = new Vector3 (shapeModule.radius, shapeModule.angle, mainModule.startSpeedMultiplier);
//radiusAngleRange = Handles.ConeFrustrumHandle (Quaternion.identity, Vector3.zero, radiusAngleRange);
radiusAngleRange = Call<Vector3> (typeof (Handles), "ConeFrustrumHandle", Quaternion.identity, Vector3.zero, radiusAngleRange, 7);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Cone Handle Change");
shapeModule.radius = radiusAngleRange.x;
shapeModule.angle = radiusAngleRange.y;
mainModule.startSpeedMultiplier = radiusAngleRange.z;
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (Vector3.zero, Quaternion.Euler (90.0f, 0.0f, 180.0f), Vector3.one * shapeModule.radius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_CircleMesh, true, s_TextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.ConeVolume)
{
// Thickness
Handles.color *= s_ShapeGizmoThicknessTint;
EditorGUI.BeginChangeCheck ();
float angleThickness = Mathf.Lerp (shapeModule.angle, 0.0f, shapeModule.radiusThickness);
Vector3 radiusThicknessAngleLength = new Vector3 (shapeModule.radius * (1.0f - shapeModule.radiusThickness), angleThickness, shapeModule.length);
//radiusThicknessAngleLength = Handles.ConeFrustrumHandle (Quaternion.identity, Vector3.zero, radiusThicknessAngleLength, Handles.ConeHandles.Radius);
radiusThicknessAngleLength = Call<Vector3> (typeof (Handles), "ConeFrustrumHandle", Quaternion.identity, Vector3.zero, radiusThicknessAngleLength, 1);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Cone Volume Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (radiusThicknessAngleLength.x / shapeModule.radius);
}
// Cone
Handles.color = s_GizmoColor;
EditorGUI.BeginChangeCheck ();
Vector3 radiusAngleLength = new Vector3 (shapeModule.radius, shapeModule.angle, shapeModule.length);
//radiusAngleLength = Handles.ConeFrustrumHandle (Quaternion.identity, Vector3.zero, radiusAngleLength);
radiusAngleLength = Call<Vector3> (typeof (Handles), "ConeFrustrumHandle", Quaternion.identity, Vector3.zero, radiusAngleLength, 7);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Cone Volume Handle Change");
shapeModule.radius = radiusAngleLength.x;
shapeModule.angle = radiusAngleLength.y;
shapeModule.length = radiusAngleLength.z;
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (Vector3.zero, Quaternion.Euler (90.0f, 0.0f, 180.0f), Vector3.one * shapeModule.radius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_CircleMesh, true, s_TextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.Box || type == ParticleSystemShapeType.BoxShell || type == ParticleSystemShapeType.BoxEdge)
{
EditorGUI.BeginChangeCheck ();
_boxBoundsHandle.center = Vector3.zero;
_boxBoundsHandle.size = shapeModule.scale;
_boxBoundsHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Box Handle Change");
shapeModule.scale = _boxBoundsHandle.size;
}
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (new Vector3 (0.0f, 0.0f, -m_BoxBoundsHandle.size.z * 0.5f), Quaternion.identity, m_BoxBoundsHandle.size);
//OnSceneViewTextureGUI (shapeModule, s_QuadMesh, true, s_TextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.Donut)
{
// Radius
EditorGUI.BeginChangeCheck ();
_arcHandle.radius = shapeModule.radius;
_arcHandle.angle = shapeModule.arc;
_arcHandle.SetColorWithRadiusHandle (Color.white, 0f);
_arcHandle.wireframeColor = Color.clear;
using (new Handles.DrawingScope (Handles.matrix * s_ArcHandleOffsetMatrix))
_arcHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Donut Handle Change");
shapeModule.radius = _arcHandle.radius;
shapeModule.arc = _arcHandle.angle;
}
// Donut extents
using (new Handles.DrawingScope (Handles.matrix * s_ArcHandleOffsetMatrix))
{
float excessAngle = shapeModule.arc % 360f;
float angle = Mathf.Abs (shapeModule.arc) >= 360f ? 360f : excessAngle;
Handles.DrawWireArc (new Vector3 (0.0f, shapeModule.donutRadius, 0.0f), Vector3.up, Vector3.forward, angle, shapeModule.radius);
Handles.DrawWireArc (new Vector3 (0.0f, -shapeModule.donutRadius, 0.0f), Vector3.up, Vector3.forward, angle, shapeModule.radius);
Handles.DrawWireArc (Vector3.zero, Vector3.up, Vector3.forward, angle, shapeModule.radius + shapeModule.donutRadius);
Handles.DrawWireArc (Vector3.zero, Vector3.up, Vector3.forward, angle, shapeModule.radius - shapeModule.donutRadius);
if (shapeModule.arc != 360.0f)
{
Quaternion arcRotation = Quaternion.AngleAxis (shapeModule.arc, Vector3.up);
Vector3 capCenter = arcRotation * Vector3.forward * shapeModule.radius;
Handles.DrawWireDisc (capCenter, arcRotation * Vector3.right, shapeModule.donutRadius);
}
}
// Donut thickness
_sphereBoundsHandle.axes = PrimitiveBoundsHandle.Axes.X | PrimitiveBoundsHandle.Axes.Y;
_sphereBoundsHandle.radius = shapeModule.donutRadius * (1.0f - shapeModule.radiusThickness);
_sphereBoundsHandle.center = Vector3.zero;
_sphereBoundsHandle.SetColor (s_ShapeGizmoThicknessTint);
const float handleInterval = 90.0f;
int numOuterRadii = Mathf.Max (1, (int)Mathf.Ceil (shapeModule.arc / handleInterval));
Matrix4x4 donutRadiusStartMatrix = Matrix4x4.TRS (new Vector3 (shapeModule.radius, 0.0f, 0.0f), Quaternion.Euler (90.0f, 0.0f, 0.0f), Vector3.one);
for (int i = 0; i < numOuterRadii; i++)
{
EditorGUI.BeginChangeCheck ();
using (new Handles.DrawingScope (Handles.matrix * (Matrix4x4.Rotate (Quaternion.Euler (0.0f, 0.0f, handleInterval * i)) * donutRadiusStartMatrix)))
_sphereBoundsHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Donut Radius Thickness Handle Change");
shapeModule.radiusThickness = 1.0f - (_sphereBoundsHandle.radius / shapeModule.donutRadius);
}
}
// Donut radius
_sphereBoundsHandle.radius = shapeModule.donutRadius;
_sphereBoundsHandle.SetColor (Color.white);
for (int i = 0; i < numOuterRadii; i++)
{
EditorGUI.BeginChangeCheck ();
using (new Handles.DrawingScope (Handles.matrix * (Matrix4x4.Rotate (Quaternion.Euler (0.0f, 0.0f, handleInterval * i)) * donutRadiusStartMatrix)))
_sphereBoundsHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Donut Radius Handle Change");
shapeModule.donutRadius = _sphereBoundsHandle.radius;
}
}
// Texture
//Matrix4x4 textureTransform = transformMatrix * Matrix4x4.TRS (new Vector3 (shapeModule.radius, 0.0f, 0.0f), Quaternion.Euler (180.0f, 0.0f, 180.0f), Vector3.one * shapeModule.donutRadius * 2.0f);
//OnSceneViewTextureGUI (shapeModule, s_CircleMesh, true, s_TextureMaterial, textureTransform);
}
else if (type == ParticleSystemShapeType.SingleSidedEdge)
{
EditorGUI.BeginChangeCheck ();
//float radius = Handles.DoSimpleEdgeHandle (Quaternion.identity, Vector3.zero, shapeModule.radius);
float radius = Call<float> (typeof (Handles), "DoSimpleEdgeHandle", Quaternion.identity, Vector3.zero, shapeModule.radius);
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Edge Handle Change");
shapeModule.radius = radius;
}
}
else if (type == ParticleSystemShapeType.Mesh)
{
Mesh mesh = shapeModule.mesh;
if (mesh)
{
bool orgWireframeMode = GL.wireframe;
GL.wireframe = true;
s_Material.SetPass (0);
Graphics.DrawMeshNow (mesh, transformMatrix);
GL.wireframe = orgWireframeMode;
//OnSceneViewTextureGUI (shapeModule, mesh, false, s_TextureMaterial, transformMatrix);
}
}
else if (type == ParticleSystemShapeType.Rectangle)
{
EditorGUI.BeginChangeCheck ();
_boxBoundsHandle.center = Vector3.zero;
_boxBoundsHandle.size = new Vector3 (shapeModule.scale.x, shapeModule.scale.y, 0.0f);
_boxBoundsHandle.DrawHandle ();
if (EditorGUI.EndChangeCheck ())
{
Undo.RecordObject (ps, "Rectangle Handle Change");
shapeModule.scale = new Vector3 (_boxBoundsHandle.size.x, _boxBoundsHandle.size.y, 0.0f);
}
//OnSceneViewTextureGUI (shapeModule, s_QuadMesh, true, s_TextureMaterial, transformMatrix * Matrix4x4.Scale (m_BoxBoundsHandle.size));
}
else if (type == ParticleSystemShapeType.Sprite)
{
Sprite sprite = shapeModule.sprite;
if (sprite)
{
if (!_spriteMesh)
{
_spriteMesh = new Mesh ();
_spriteMesh.name = "ParticleSpritePreview";
_spriteMesh.hideFlags |= HideFlags.HideAndDontSave;
}
_spriteMesh.vertices = Array.ConvertAll (sprite.vertices, i => (Vector3)i);
_spriteMesh.uv = sprite.uv;
_spriteMesh.triangles = Array.ConvertAll (sprite.triangles, i => (int)i);
bool orgWireframeMode = GL.wireframe;
GL.wireframe = true;
s_Material.SetPass (0);
Graphics.DrawMeshNow (_spriteMesh, transformMatrix);
GL.wireframe = orgWireframeMode;
//OnSceneViewTextureGUI (shapeModule, m_SpriteMesh, false, s_TextureMaterial, transformMatrix);
}
}
}
Handles.color = origCol;
Handles.matrix = orgMatrix;
}
}
}

View File

@ -44,10 +44,10 @@ namespace Coffee.UIExtensions
get
{
Texture tex = null;
if (!m_IsTrail)
if (!m_IsTrail && particleSystem)
{
Profiler.BeginSample ("Check TextureSheetAnimation module");
var textureSheet = m_ParticleSystem.textureSheetAnimation;
var textureSheet = particleSystem.textureSheetAnimation;
if (textureSheet.enabled && textureSheet.mode == ParticleSystemAnimationMode.Sprites && 0 < textureSheet.spriteCount)
{
tex = textureSheet.GetSprite (0).texture;
@ -94,18 +94,37 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Is this the root UIParticle?
/// </summary>
public bool isRoot
{
get { return !_parent; }
}
/// <summary>
/// Should this graphic be considered a target for raycasting?
/// </summary>
public override bool raycastTarget { get { return false; } set { base.raycastTarget = value; } }
/// <summary>
/// ParticleSystem.
/// </summary>
new public ParticleSystem particleSystem { get { return m_ParticleSystem ? m_ParticleSystem : (m_ParticleSystem = GetComponent<ParticleSystem> ()); } }
/// <summary>
/// Perform material modification in this function.
/// </summary>
/// <returns>Modified material.</returns>
/// <param name="baseMaterial">Configured Material.</param>
public override Material GetModifiedMaterial (Material baseMaterial)
{
return base.GetModifiedMaterial (_renderer ? _renderer.sharedMaterial : baseMaterial);
}
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected override void OnEnable ()
{
// Register.
@ -123,8 +142,7 @@ namespace Coffee.UIExtensions
}
s_TempRelatables.Clear ();
m_ParticleSystem = m_ParticleSystem ? m_ParticleSystem : GetComponent<ParticleSystem> ();
_renderer = m_ParticleSystem ? m_ParticleSystem.GetComponent<ParticleSystemRenderer> () : null;
_renderer = particleSystem ? particleSystem.GetComponent<ParticleSystemRenderer> () : null;
// Create objects.
_mesh = new Mesh ();
@ -134,6 +152,9 @@ namespace Coffee.UIExtensions
base.OnEnable ();
}
/// <summary>
/// This function is called when the behaviour becomes disabled.
/// </summary>
protected override void OnDisable ()
{
// Unregister.
@ -159,6 +180,9 @@ namespace Coffee.UIExtensions
base.OnDisable ();
}
/// <summary>
/// Call to update the geometry of the Graphic onto the CanvasRenderer.
/// </summary>
protected override void UpdateGeometry ()
{
}
@ -183,6 +207,9 @@ namespace Coffee.UIExtensions
base.OnTransformParentChanged ();
}
/// <summary>
/// Callback for when properties have been changed by animation.
/// </summary>
protected override void OnDidApplyAnimationProperties ()
{
}
@ -208,6 +235,9 @@ namespace Coffee.UIExtensions
List<UIParticle> _children = new List<UIParticle> ();
Matrix4x4 scaleaMatrix = default (Matrix4x4);
/// <summary>
/// Update meshes.
/// </summary>
static void UpdateMeshes ()
{
foreach (var uip in s_ActiveParticles)
@ -219,6 +249,9 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Update meshe.
/// </summary>
void UpdateMesh ()
{
try
@ -229,6 +262,7 @@ namespace Coffee.UIExtensions
if (m_ParticleSystem && canvas)
{
var rootCanvas = canvas.rootCanvas;
Profiler.BeginSample ("Disable ParticleSystemRenderer");
if (Application.isPlaying)
{
@ -239,7 +273,7 @@ namespace Coffee.UIExtensions
Profiler.BeginSample ("Make Matrix");
scaleaMatrix = m_ParticleSystem.main.scalingMode == ParticleSystemScalingMode.Hierarchy
? Matrix4x4.Scale (scale * Vector3.one)
: Matrix4x4.Scale (scale * canvas.rootCanvas.transform.localScale);
: Matrix4x4.Scale (scale * rootCanvas.transform.localScale);
Matrix4x4 matrix = default (Matrix4x4);
switch (m_ParticleSystem.main.simulationSpace)
{
@ -263,13 +297,21 @@ namespace Coffee.UIExtensions
if (0 < m_ParticleSystem.particleCount)
{
Profiler.BeginSample ("Bake Mesh");
var cam = rootCanvas.renderMode == RenderMode.ScreenSpaceOverlay
? UIParticleOverlayCamera.GetCameraForOvrelay (rootCanvas)
: canvas.worldCamera ?? Camera.main;
if (!cam)
{
return;
}
if (m_IsTrail)
{
_renderer.BakeTrailsMesh (_mesh, true);
_renderer.BakeTrailsMesh (_mesh, cam, true);
}
else
{
_renderer.BakeMesh (_mesh, true);
_renderer.BakeMesh (_mesh, cam, true);
}
Profiler.EndSample ();
@ -300,6 +342,9 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Checks the trail.
/// </summary>
void CheckTrail ()
{
if (isActiveAndEnabled && !m_IsTrail && m_ParticleSystem && m_ParticleSystem.trails.enabled)

View File

@ -0,0 +1,110 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Coffee.UIExtensions
{
/// <summary>
/// </summary>
[ExecuteInEditMode]
public class UIParticleOverlayCamera : MonoBehaviour
{
//################################
// Public/Protected Members.
//################################
/// <summary>
/// Get instance object.
/// If instance does not exist, Find instance in scene, or create new one.
/// </summary>
public static UIParticleOverlayCamera instance
{
get
{
// 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.gameObject.SetActive (true);
s_Instance.enabled = true;
}
return s_Instance;
}
}
public static Camera GetCameraForOvrelay (Canvas canvas)
{
var i = instance;
var rt = canvas.rootCanvas.transform as RectTransform;
var cam = i.cameraForOvrelay;
var trans = i.transform;
cam.enabled = false;
var pos = rt.localPosition;
cam.orthographic = true;
cam.orthographicSize = Mathf.Max (pos.x, pos.y);
cam.nearClipPlane = 0.3f;
cam.farClipPlane = 1000f;
pos.z -= 100;
trans.localPosition = pos;
return cam;
}
//################################
// Private Members.
//################################
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;
/// <summary>
/// Awake is called when the script instance is being loaded.
/// </summary>
void Awake ()
{
// Hold the instance.
if (s_Instance == null)
{
s_Instance = GetComponent<UIParticleOverlayCamera> ();
}
// If the instance is duplicated, destroy itself.
else if (s_Instance != this)
{
UnityEngine.Debug.LogWarning ("Multiple " + typeof (UIParticleOverlayCamera).Name + " in scene.", this.gameObject);
enabled = false;
#if UNITY_EDITOR
if (!Application.isPlaying)
{
DestroyImmediate (gameObject);
}
else
#endif
{
Destroy (gameObject);
}
return;
}
cameraForOvrelay.enabled = false;
// Singleton has DontDestroy flag.
if (Application.isPlaying)
{
DontDestroyOnLoad (gameObject);
}
}
/// <summary>
/// This function is called when the MonoBehaviour will be destroyed.
/// </summary>
void OnDestroy ()
{
// Clear instance on destroy.
if (s_Instance == this)
{
s_Instance = null;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f69dfb25b53b14addbd71dbebdbaa132
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,18 @@
# Changelog
## [v1.3.0](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v1.3.0) (2018-12-21)
[Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v1.2.1...v1.3.0)
With Gizmo you can control the scaled Shape.
![](https://user-images.githubusercontent.com/12690315/50343861-f31e4e80-056b-11e9-8f60-8bd0a8ff7adb.gif)
**Fixed bugs:**
- In overlay, particle size is too small [\#23](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/23)
- Assertion failed on expression: 'IsNormalized\(normal, 0.001f\)' [\#22](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/22)
- UIParticle.Scale does not affect the gizmo of shape module [\#21](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/21)
## [v1.2.1](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v1.2.1) (2018-12-13)
[Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v1.2.0...v1.2.1)

View File

@ -11,4 +11,7 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Coffee/UIExtensions/UIParticle/Demo/UIParticle_Demo_ScaleTest.unity
guid: 728f1c107bd0b49418a7e499b481b8da
- enabled: 1
path: Assets/Coffee/UIExtensions/UIParticle/Demo/UIParticle_Demo_ScaleTest2.unity
guid: 712b3f963876343cebf8429fee2f2b57
m_configObjects: {}

View File

@ -51,6 +51,9 @@ Compares this "Baking mesh" approach with the conventional approach:
* Scaling independent of Transform
* No heavy allocation every frame
* All ParticleSystem.ScalingModes and all Canvas.RenderModes are supported. They look almost the same in all modes.
![](https://user-images.githubusercontent.com/12690315/49866926-6c22f500-fe4c-11e8-8393-d5a546e9e2d3.gif)
* Scaled gizmo
![](https://user-images.githubusercontent.com/12690315/50343861-f31e4e80-056b-11e9-8f60-8bd0a8ff7adb.gif)
<br><br><br><br>

View File

@ -1,6 +1,6 @@
{
"name": "ParticleEffectForUGUI",
"version": "1.2.1",
"version": "1.3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/mob-sakai/ParticleEffectForUGUI.git"