release v1.0.0

pull/33/head
mob-sakai 2018-07-13 15:09:28 +09:00
commit d14f3e142c
9 changed files with 894 additions and 199 deletions

View File

@ -240,8 +240,8 @@ ParticleSystem:
startSize:
serializedVersion: 2
minMaxState: 3
scalar: 0.3
minScalar: 0.05
scalar: 0.5
minScalar: 0.2
maxCurve:
serializedVersion: 2
m_Curve:
@ -1098,8 +1098,8 @@ ParticleSystem:
m_NumColorKeys: 2
m_NumAlphaKeys: 2
UVModule:
enabled: 1
mode: 0
enabled: 0
mode: 1
frameOverTime:
serializedVersion: 2
minMaxState: 1
@ -1216,7 +1216,7 @@ ParticleSystem:
flipV: 0
randomRow: 1
sprites:
- sprite: {fileID: 0}
- sprite: {fileID: 21300000, guid: 925f66fdcc9764b579413b7408c718f2, type: 3}
VelocityModule:
enabled: 0
x:

View File

@ -1,12 +1,43 @@
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions.Demo
{
public class UIParticle_Demo : MonoBehaviour
{
[SerializeField] Sprite m_Sprite;
[SerializeField] ParticleSystem[] m_ParticleSystems;
[SerializeField] Mask[] m_Masks;
public void SetTimeScale(float scale)
{
Time.timeScale = scale;
}
public void EnableTrailRibbon(bool ribbonMode)
{
foreach(var p in m_ParticleSystems)
{
var trails = p.trails;
trails.mode = ribbonMode ? ParticleSystemTrailMode.Ribbon : ParticleSystemTrailMode.PerParticle;
}
}
public void EnableSprite(bool enabled)
{
foreach(var p in m_ParticleSystems)
{
var tex = p.textureSheetAnimation;
tex.enabled = enabled;
}
}
public void EnableMask(bool enabled)
{
foreach(var m in m_Masks)
{
m.enabled = enabled;
}
}
}
}

View File

@ -220,6 +220,11 @@ RectTransform:
m_AnchoredPosition: {x: 305, y: -93.333336}
m_SizeDelta: {x: 190, y: 186.66667}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!198 &40867143 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
m_PrefabInternal: {fileID: 356871726}
--- !u!1 &68831704
GameObject:
m_ObjectHideFlags: 0
@ -314,6 +319,76 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &141837617
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 141837618}
- component: {fileID: 141837620}
- component: {fileID: 141837619}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &141837618
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 141837617}
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: 1650678472}
m_Father: {fileID: 919687610}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 63.7, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &141837619
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 141837617}
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
--- !u!222 &141837620
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 141837617}
m_CullTransparentMesh: 0
--- !u!1 &147269786
GameObject:
m_ObjectHideFlags: 0
@ -911,6 +986,11 @@ Canvas:
m_SortingLayerID: 0
m_SortingOrder: 3
m_TargetDisplay: 0
--- !u!198 &453963074 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
m_PrefabInternal: {fileID: 1135460004}
--- !u!1 &473819141
GameObject:
m_ObjectHideFlags: 0
@ -922,7 +1002,7 @@ GameObject:
- component: {fileID: 473819144}
- component: {fileID: 473819143}
m_Layer: 5
m_Name: Toggle
m_Name: Toggle (Mask)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1009,52 +1089,8 @@ MonoBehaviour:
onValueChanged:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1990444707}
m_MethodName: set_enabled
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1796369711}
m_MethodName: set_enabled
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 829344119}
m_MethodName: set_enabled
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 203308589}
m_MethodName: set_enabled
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1916732546}
m_MethodName: set_enabled
- m_Target: {fileID: 993972853}
m_MethodName: EnableMask
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
@ -1078,7 +1114,7 @@ GameObject:
- component: {fileID: 475799740}
- component: {fileID: 475799739}
m_Layer: 5
m_Name: Slider
m_Name: Slider (Time scale)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1413,6 +1449,11 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 495893252}
m_CullTransparentMesh: 0
--- !u!198 &495893256 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
m_PrefabInternal: {fileID: 495893250}
--- !u!1 &517084413
GameObject:
m_ObjectHideFlags: 0
@ -1777,6 +1818,11 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 577827897}
m_CullTransparentMesh: 0
--- !u!198 &683882518 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
m_PrefabInternal: {fileID: 1995702774}
--- !u!1 &738945209
GameObject:
m_ObjectHideFlags: 0
@ -2019,6 +2065,257 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &873189076
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 873189077}
- component: {fileID: 873189079}
- component: {fileID: 873189078}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &873189077
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 873189076}
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: 926331316}
m_Father: {fileID: 1626066441}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 63.7, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &873189078
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 873189076}
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
--- !u!222 &873189079
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 873189076}
m_CullTransparentMesh: 0
--- !u!1 &919687609
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 919687610}
- component: {fileID: 919687612}
- component: {fileID: 919687611}
m_Layer: 5
m_Name: Toggle (Ribbon)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &919687610
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 919687609}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.9998866, y: 0.9998866, z: 0.9998866}
m_Children:
- {fileID: 141837618}
- {fileID: 1624949831}
m_Father: {fileID: 1810222380}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 107.09, y: -74}
m_SizeDelta: {x: 194.81, y: 21.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &919687611
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 919687609}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &919687612
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 919687609}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 2109663825, 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: 141837619}
toggleTransition: 1
graphic: {fileID: 1650678473}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 993972853}
m_MethodName: EnableTrailRibbon
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_IsOn: 0
--- !u!1 &926331315
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 926331316}
- component: {fileID: 926331318}
- component: {fileID: 926331317}
m_Layer: 5
m_Name: Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &926331316
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 926331315}
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: 873189077}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &926331317
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 926331315}
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: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &926331318
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 926331315}
m_CullTransparentMesh: 0
--- !u!1 &992843453
GameObject:
m_ObjectHideFlags: 0
@ -2242,6 +2539,19 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: eba3b7ce20b7f470a891c84def6be7e4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Sprite: {fileID: 0}
m_ParticleSystems:
- {fileID: 40867143}
- {fileID: 2105248810}
- {fileID: 495893256}
- {fileID: 453963074}
- {fileID: 683882518}
m_Masks:
- {fileID: 829344119}
- {fileID: 1990444707}
- {fileID: 1796369711}
- {fileID: 203308589}
- {fileID: 1916732546}
--- !u!1 &1040694054
GameObject:
m_ObjectHideFlags: 0
@ -2854,6 +3164,81 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1269035766}
m_CullTransparentMesh: 0
--- !u!1 &1351227236
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1351227237}
- component: {fileID: 1351227239}
- component: {fileID: 1351227238}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1351227237
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1351227236}
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: 1626066441}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -71.48999, y: 0.6500101}
m_SizeDelta: {x: -142.98, y: -1.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1351227238
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1351227236}
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: 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Sprites
--- !u!222 &1351227239
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1351227236}
m_CullTransparentMesh: 0
--- !u!1 &1410684353
GameObject:
m_ObjectHideFlags: 0
@ -3386,6 +3771,262 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 224334368915820964, guid: 293537681b71040d0a9b03e13c0e4a20,
type: 2}
m_PrefabInternal: {fileID: 1622082339}
--- !u!1 &1624949830
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1624949831}
- component: {fileID: 1624949833}
- component: {fileID: 1624949832}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1624949831
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1624949830}
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: 919687610}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -71.48999, y: 0.6500101}
m_SizeDelta: {x: -142.98, y: -1.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1624949832
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1624949830}
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: 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Ribbon
--- !u!222 &1624949833
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1624949830}
m_CullTransparentMesh: 0
--- !u!1 &1626066440
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1626066441}
- component: {fileID: 1626066443}
- component: {fileID: 1626066442}
m_Layer: 5
m_Name: Toggle (Sprites)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1626066441
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1626066440}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.9998866, y: 0.9998866, z: 0.9998866}
m_Children:
- {fileID: 873189077}
- {fileID: 1351227237}
m_Father: {fileID: 1810222380}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 107.09, y: -106}
m_SizeDelta: {x: 194.81, y: 21.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1626066442
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1626066440}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &1626066443
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1626066440}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 2109663825, 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: 873189078}
toggleTransition: 1
graphic: {fileID: 926331317}
m_Group: {fileID: 0}
onValueChanged:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 993972853}
m_MethodName: EnableSprite
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_IsOn: 0
--- !u!1 &1650678471
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1650678472}
- component: {fileID: 1650678474}
- component: {fileID: 1650678473}
m_Layer: 5
m_Name: Checkmark
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1650678472
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1650678471}
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: 141837618}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1650678473
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1650678471}
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: 10901, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1650678474
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1650678471}
m_CullTransparentMesh: 0
--- !u!1001 &1700081082
Prefab:
m_ObjectHideFlags: 0
@ -3492,6 +4133,10 @@ Prefab:
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1477837436527380, guid: 293537681b71040d0a9b03e13c0e4a20, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 293537681b71040d0a9b03e13c0e4a20, type: 2}
m_IsPrefabAsset: 0
@ -3804,6 +4449,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1810222380}
- component: {fileID: 1810222381}
m_Layer: 5
m_Name: Control
m_TagString: Untagged
@ -3823,6 +4469,8 @@ RectTransform:
m_Children:
- {fileID: 473819142}
- {fileID: 475799738}
- {fileID: 919687610}
- {fileID: 1626066441}
m_Father: {fileID: 1918337914}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -3831,6 +4479,28 @@ RectTransform:
m_AnchoredPosition: {x: 95, y: -93.333336}
m_SizeDelta: {x: 190, y: 186.66667}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1810222381
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1810222379}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
--- !u!1 &1844207550
GameObject:
m_ObjectHideFlags: 0
@ -4101,7 +4771,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 200, y: -93.333336}
m_AnchoredPosition: {x: 200, y: -93.33334}
m_SizeDelta: {x: 400, y: 186.66667}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1918337915
@ -4611,6 +5281,31 @@ Prefab:
propertyPath: m_RenderMode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
propertyPath: UVModule.mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
propertyPath: UVModule.sprites.Array.data[0].sprite
value:
objectReference: {fileID: 21300000, guid: 925f66fdcc9764b579413b7408c718f2,
type: 3}
- target: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
propertyPath: UVModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1637072316030346, guid: 77533a9d6813e4163a176c4206b0aba2, type: 2}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 198474937898253256, guid: 77533a9d6813e4163a176c4206b0aba2,
type: 2}
propertyPath: TrailModule.mode
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 77533a9d6813e4163a176c4206b0aba2, type: 2}
m_IsPrefabAsset: 0

View File

@ -37,8 +37,32 @@ namespace Coffee.UIExtensions
{
get
{
var mat = _renderer ? _renderer.sharedMaterial : defaultGraphicMaterial;
return mat && mat.HasProperty(s_IdMainTex) ? mat.mainTexture : s_WhiteTexture; ;
Texture tex = null;
if (!m_IsTrail)
{
Profiler.BeginSample("Check TextureSheetAnimation module");
var textureSheet = m_ParticleSystem.textureSheetAnimation;
if (textureSheet.enabled && textureSheet.mode == ParticleSystemAnimationMode.Sprites && 0 < textureSheet.spriteCount)
{
tex = textureSheet.GetSprite(0).texture;
}
Profiler.EndSample();
}
if (!tex && _renderer)
{
Profiler.BeginSample("Check material");
var mat = m_IsTrail
? _renderer.trailMaterial
: Application.isPlaying
? _renderer.material
: _renderer.sharedMaterial;
if (mat && mat.HasProperty(s_IdMainTex))
{
tex = mat.mainTexture;
}
Profiler.EndSample();
}
return tex ?? s_WhiteTexture;
}
}
@ -56,10 +80,13 @@ namespace Coffee.UIExtensions
_mesh.MarkDynamic();
CheckTrail();
base.OnEnable();
Canvas.willRenderCanvases += UpdateMesh;
}
protected override void OnDisable()
{
Canvas.willRenderCanvases -= UpdateMesh;
DestroyImmediate(_mesh);
_mesh = null;
CheckTrail();
@ -76,73 +103,81 @@ namespace Coffee.UIExtensions
Mesh _mesh;
ParticleSystemRenderer _renderer;
void Update()
void UpdateMesh()
{
Profiler.BeginSample("CheckTrail");
CheckTrail();
Profiler.EndSample();
if (m_ParticleSystem)
try
{
Profiler.BeginSample("Disable ParticleSystemRenderer");
if (Application.isPlaying)
{
_renderer.enabled = false;
}
Profiler.BeginSample("CheckTrail");
CheckTrail();
Profiler.EndSample();
Profiler.BeginSample("Make Matrix");
var cam = canvas.worldCamera ?? Camera.main;
bool useTransform = false;
Matrix4x4 matrix = default(Matrix4x4);
switch (m_ParticleSystem.main.simulationSpace)
if (m_ParticleSystem)
{
case ParticleSystemSimulationSpace.Local:
matrix =
Matrix4x4.Rotate(m_ParticleSystem.transform.rotation).inverse
* Matrix4x4.Scale(m_ParticleSystem.transform.lossyScale).inverse;
useTransform = true;
break;
case ParticleSystemSimulationSpace.World:
matrix = m_ParticleSystem.transform.worldToLocalMatrix;
break;
case ParticleSystemSimulationSpace.Custom:
break;
}
Profiler.EndSample();
_mesh.Clear();
if (0 < m_ParticleSystem.particleCount)
{
Profiler.BeginSample("Bake Mesh");
if (m_IsTrail)
Profiler.BeginSample("Disable ParticleSystemRenderer");
if (Application.isPlaying)
{
_renderer.BakeTrailsMesh(_mesh, cam, useTransform);
}
else
{
_renderer.BakeMesh(_mesh, cam, useTransform);
_renderer.enabled = false;
}
Profiler.EndSample();
// Apply matrix.
Profiler.BeginSample("Apply matrix to position");
_mesh.GetVertices(s_Vertices);
var count = s_Vertices.Count;
for (int i = 0; i < count; i++)
Profiler.BeginSample("Make Matrix");
var cam = canvas.worldCamera ?? Camera.main;
bool useTransform = false;
Matrix4x4 matrix = default(Matrix4x4);
switch (m_ParticleSystem.main.simulationSpace)
{
s_Vertices[i] = matrix.MultiplyPoint3x4(s_Vertices[i]);
case ParticleSystemSimulationSpace.Local:
matrix =
Matrix4x4.Rotate(m_ParticleSystem.transform.rotation).inverse
* Matrix4x4.Scale(m_ParticleSystem.transform.lossyScale).inverse;
useTransform = true;
break;
case ParticleSystemSimulationSpace.World:
matrix = m_ParticleSystem.transform.worldToLocalMatrix;
break;
case ParticleSystemSimulationSpace.Custom:
break;
}
_mesh.SetVertices(s_Vertices);
s_Vertices.Clear();
Profiler.EndSample();
_mesh.Clear();
if (0 < m_ParticleSystem.particleCount)
{
Profiler.BeginSample("Bake Mesh");
if (m_IsTrail)
{
_renderer.BakeTrailsMesh(_mesh, cam, useTransform);
}
else
{
_renderer.BakeMesh(_mesh, cam, useTransform);
}
Profiler.EndSample();
// Apply matrix.
Profiler.BeginSample("Apply matrix to position");
_mesh.GetVertices(s_Vertices);
var count = s_Vertices.Count;
for (int i = 0; i < count; i++)
{
s_Vertices[i] = matrix.MultiplyPoint3x4(s_Vertices[i]);
}
_mesh.SetVertices(s_Vertices);
s_Vertices.Clear();
Profiler.EndSample();
}
// Set mesh to CanvasRenderer.
Profiler.BeginSample("Set mesh and texture to CanvasRenderer");
canvasRenderer.SetMesh(_mesh);
canvasRenderer.SetTexture(mainTexture);
Profiler.EndSample();
}
// Set mesh to CanvasRenderer.
Profiler.BeginSample("Set mesh to CanvasRenderer");
canvasRenderer.SetMesh(_mesh);
Profiler.EndSample();
}
catch(System.Exception e)
{
Debug.LogException(e);
}
}

View File

@ -1,5 +1,19 @@
# Changelog
## [v1.0.0](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v1.0.0) (2018-07-13)
[Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v0.1.0...v1.0.0)
Let's use particle for your UI!
UIParticle is use easy.
The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.
![](https://user-images.githubusercontent.com/12690315/41771577-8da4b968-7650-11e8-9524-cd162c422d9d.gif)
**Implemented enhancements:**
- Supports sprites [\#5](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/5)
- Use Canvas.willRenderCanvases event instead of LateUpdate [\#4](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/4)
## [v0.1.0](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v0.1.0) (2018-06-22)
[Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/6b89c14a5144e290e55d041bc0ad03756a113ae0...v0.1.0)

View File

@ -1 +1 @@
m_EditorVersion: 2018.2.0b9
m_EditorVersion: 2018.2.0f2

View File

@ -33,7 +33,7 @@ Compares this "Baking mesh" approach with the conventional approach:
|Approach|Good|Bad|Screenshot|
|-|-|-|-|
|Baking mesh<br>**\(UIParticle\)**|Rendered as is.<br>Maskable.<br>Sortable.<br>Less objects.|**Requires Unity 2018.2+.**<br>Requires UI shaders.|<img src="https://user-images.githubusercontent.com/12690315/41765089-0302b9a2-763e-11e8-88b3-b6ffa306bbb0.gif" width="500px">|
|Baking mesh<br>**\(UIParticle\)**|Rendered as is.<br>Maskable.<br>Sortable.<br>Less objects.|**Requires Unity 2018.2+.**<br>Requires UI shaders to use Mask.|<img src="https://user-images.githubusercontent.com/12690315/41765089-0302b9a2-763e-11e8-88b3-b6ffa306bbb0.gif" width="500px">|
|Do nothing|Rendered as is.|**Looks like a glitch.**<br>Not maskable.<br>Not sortable.|<img src="https://user-images.githubusercontent.com/12690315/41765090-0329828a-763e-11e8-8d8a-f1d269ea3bc7.gif" width="500px">|
|Convert particle to UIVertex<br>[\(UIParticleSystem\)](https://forum.unity.com/threads/free-script-particle-systems-in-ui-screen-space-overlay.406862/)|Maskable.<br>Sortable.<br>Less objects.|**Adjustment is difficult.**<br>Requires UI shaders.<br>Difficult to adjust scale.<br>Force hierarchy scalling.<br>Simulation results are incorrect.<br>Trail, rotation of transform, time scaling are not supported.|<img src="https://user-images.githubusercontent.com/12690315/41765088-02deb9c6-763e-11e8-98d0-9e0c1766ef39.gif" width="500px">|
|Use Canvas to sort|Rendered as is.<br>Sortable.|**You must to manage sorting orders.**<br>Not maskable.<br>More batches.|<img src="https://user-images.githubusercontent.com/12690315/41765087-02b866ea-763e-11e8-8c33-081c9ad852f8.gif" width="500px">|
@ -55,15 +55,17 @@ Compares this "Baking mesh" approach with the conventional approach:
1. Download ParticleEffectForUGUI.unitypackage from [Releases](https://github.com/mob-sakai/ParticleEffectForUGUI/releases).
1. Import the package into your Unity project. Select `Import Package > Custom Package` from the `Assets` menu.
1. Add particle system to canvas.
1. If you want to mask particles, set the "UI/UIAdditive" shader to material.
1. Add `UIParticle` component to particle system from `Add Component` in inspector.
1. (Option) If you want to mask particles, set a UI shader such as "UI/UIAdditive" to material for ParticleSystem.
![](https://user-images.githubusercontent.com/12690315/42674022-134e3a40-86a9-11e8-8f44-a110d2f14185.gif)
1. Add `UIParticle` component to particle system from `Add Component` in inspector.
![](https://user-images.githubusercontent.com/12690315/41772125-5aca69c8-7652-11e8-8442-21f6015069a1.png)
1. That's all. There are no properties you must set in the inspector!
1. Enjoy!
##### Requirement
* Unity 2018.2+ (Tested in Unity 2018.2b9)
* Unity 2018.2+ (Tested in Unity 2018.2.0f2)
* No other SDK are required
@ -72,14 +74,6 @@ Compares this "Baking mesh" approach with the conventional approach:
<br><br><br><br>
## Development Note
#### BakeMesh API has a issue!
See [this issue](https://issuetracker.unity3d.com/issues/bakemesh-slash-baketrailsmesh-crashes-if-update-jobs-are-running).
`UIParticle` avoids the issue, but the rendering result lags one frame.
Please vote the issue to improve `UIParticle`!

View File

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

View File

@ -2,78 +2,4 @@
# NOTE: Set an environment variable `CHANGELOG_GITHUB_TOKEN` by running the following command at the prompt, or by adding it to your shell profile (e.g., ~/.bash_profile or ~/.zshrc):
# export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"
# Release the project with the following steps:
# 1. Update the release version in package.json.
# 2. Open unity project to check compile error.
# 3. Update "CHANGELOG.md" using "github_changelog_generator-1.15.0.pre.rc".
# 4. Check changelog and continue proccess.
# 5. Export unitypackage.
# 6. Commit package.json and CHANGELOG.md.
# 7. Merge into master branch.
# 8. Release using "gh-release-3.2.0". (with upload unitypackage)
# input release version
echo -e ">> Start Github Release:"
PACKAGE_NAME=`node -pe 'require("./package.json").name'`
echo -e ">> Package name: ${PACKAGE_NAME}"
CURRENT_VERSION=`grep -o -e "\"version\".*$" package.json | sed -e "s/\"version\": \"\(.*\)\".*$/\1/"`
read -p "[? release version (for current: ${CURRENT_VERSION}): " RELEASE_VERSION
[ -z "${RELEASE_VERSION}" ] && exit
# update version in package.json
echo -e "\n>> Update version... package.json"
git checkout -B release develop
sed -i -e "s/\"version\": \(.*\)/\"version\": \"${RELEASE_VERSION}\",/g" package.json
# check unity editor
UNITY_VER=`sed -e "s/m_EditorVersion: \(.*\)/\1/g" ProjectSettings/ProjectVersion.txt`
UNITY_EDITOR="/Applications/Unity/Hub/Editor/${UNITY_VER}/Unity.app/Contents/MacOS/Unity"
echo -e "\n>> Check unity editor... ${UNITY_VER} (${UNITY_EDITOR})"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -buildOSX64Player "build.app"
echo -e ">> OK"
# generate change log
CHANGELOG_GENERATOR_ARG=`grep -o -e ".*git\"$" package.json | sed -e "s/^.*\/\([^\/]*\)\/\([^\/]*\).git.*$/--user \1 --project \2/"`
CHANGELOG_GENERATOR_ARG="--future-release v${RELEASE_VERSION} ${CHANGELOG_GENERATOR_ARG}"
echo -e "\n>> Generate change log... ${CHANGELOG_GENERATOR_ARG}"
github_changelog_generator ${CHANGELOG_GENERATOR_ARG}
git diff -- CHANGELOG.md
read -p "[? is the change log correct? (y/N):" yn
case "$yn" in [yY]*) ;; *) exit ;; esac
# export unitypackage
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
echo -e "\n>> Export unitypackage... ${PACKAGE_SRC}"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"
echo -e ">> OK"
# commit release files
echo -e "\n>> Commit release files..."
git add CHANGELOG.md -f
git add package.json -f
git commit -m "update change log"
# merge and push
echo -e "\n>> Merge and push..."
git checkout master
git merge --no-ff release -m "release $TAG"
git branch -D release
git push origin master
git checkout develop
git merge --ff master
git push origin develop
# upload unitypackage and release on Github
gh-release --assets "$PACKAGE_NAME.unitypackage"
echo -e "\n\n>> $PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"
bash <(curl -sL 'https://gist.github.com/mob-sakai/a883999a32dd8b1927639e46b3cd6801/raw/unity_release.sh')