├── .gitignore
├── .idea
└── .idea.UniFader
│ └── .idea
│ ├── indexLayout.xml
│ └── vcs.xml
├── Assets
├── UniFader.meta
└── UniFader
│ ├── Materials.meta
│ ├── Materials
│ ├── UI_GradientMaskTransition.mat
│ └── UI_GradientMaskTransition.mat.meta
│ ├── Prefabs.meta
│ ├── Prefabs
│ ├── FadeCanvas.prefab
│ └── FadeCanvas.prefab.meta
│ ├── Sample.meta
│ ├── Sample
│ ├── FadeTest.cs
│ ├── FadeTest.cs.meta
│ ├── Sample.unity
│ ├── Sample.unity.meta
│ ├── Textures.meta
│ └── Textures
│ │ ├── Readme.txt
│ │ ├── Readme.txt.meta
│ │ ├── SampleGradientMasks.meta
│ │ ├── SampleGradientMasks
│ │ ├── rule_circle.png
│ │ ├── rule_circle.png.meta
│ │ ├── rule_diamond.png
│ │ ├── rule_diamond.png.meta
│ │ ├── rule_horizontal.png
│ │ ├── rule_horizontal.png.meta
│ │ ├── rule_rotate.png
│ │ ├── rule_rotate.png.meta
│ │ ├── rule_vertical.png
│ │ └── rule_vertical.png.meta
│ │ ├── unitychan_hbd.jpg
│ │ └── unitychan_hbd.jpg.meta
│ ├── Scripts.meta
│ ├── Scripts
│ ├── Editor.meta
│ ├── Editor
│ │ ├── CustomSerializeReferenceDrawer.cs
│ │ ├── CustomSerializeReferenceDrawer.cs.meta
│ │ ├── GradientMaskFadeDrawer.cs
│ │ ├── GradientMaskFadeDrawer.cs.meta
│ │ ├── UniFaderEditor.cs
│ │ ├── UniFaderEditor.cs.meta
│ │ ├── Utility.meta
│ │ └── Utility
│ │ │ ├── DrawUtility.cs
│ │ │ ├── DrawUtility.cs.meta
│ │ │ ├── TypeUtility.cs
│ │ │ └── TypeUtility.cs.meta
│ ├── FadePatterns.meta
│ ├── FadePatterns
│ │ ├── ColorFade.cs
│ │ ├── ColorFade.cs.meta
│ │ ├── GradientMaskFade.cs
│ │ ├── GradientMaskFade.cs.meta
│ │ ├── IFadePatern.cs
│ │ └── IFadePatern.cs.meta
│ ├── UniFader.cs
│ └── UniFader.cs.meta
│ ├── Shader.meta
│ └── Shader
│ ├── GradientMaskTransition.shader
│ └── GradientMaskTransition.shader.meta
├── LICENSE
├── Logs
└── Packages-Update.log
├── Packages
└── manifest.json
├── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── NavMeshAreas.asset
├── Physics2DSettings.asset
├── PresetManager.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── TagManager.asset
├── TimeManager.asset
├── UnityConnectSettings.asset
├── VFXManager.asset
└── XRSettings.asset
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | [Ll]ibrary/
2 | [Tt]emp/
3 | [Oo]bj/
4 | [Bb]uild/
5 | [Bb]uilds/
6 | Assets/AssetStoreTools*
7 |
8 | # Visual Studio cache directory
9 | .vs/
10 |
11 | # Autogenerated VS/MD/Consulo solution and project files
12 | ExportedObj/
13 | .consulo/
14 | *.csproj
15 | *.unityproj
16 | *.sln
17 | *.suo
18 | *.tmp
19 | *.user
20 | *.userprefs
21 | *.pidb
22 | *.booproj
23 | *.svd
24 | *.pdb
25 | *.opendb
26 |
27 | # Unity3D generated meta files
28 | *.pidb.meta
29 | *.pdb.meta
30 |
31 | # Unity3D Generated File On Crash Reports
32 | sysinfo.txt
33 |
34 | # Builds
35 | *.apk
36 | *.unitypackage
37 |
--------------------------------------------------------------------------------
/.idea/.idea.UniFader/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Library/PackageCache/com.unity.2d.common@2.0.2
7 | Library/PackageCache/com.unity.collab-proxy@1.2.16
8 | Library/PackageCache/com.unity.ext.nunit@1.0.0
9 | Library/PackageCache/com.unity.ide.rider@1.1.0
10 | Library/PackageCache/com.unity.ide.vscode@1.1.2
11 | Library/PackageCache/com.unity.test-framework@1.1.3
12 | Library/PackageCache/com.unity.textmeshpro@2.0.1
13 | Library/PackageCache/com.unity.timeline@1.2.6
14 | Packages
15 | ProjectSettings
16 |
17 |
18 | .git
19 | .idea
20 | Library
21 | Logs
22 | Temp
23 | obj
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.idea/.idea.UniFader/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Assets/UniFader.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a301a5407132e4e4c88879e3012d026f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: da7d0c51506934b2287d81da22a39225
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Materials/UI_GradientMaskTransition.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: UI_GradientMaskTransition
11 | m_Shader: {fileID: 4800000, guid: c3c429942dc6e455f93787e7ef006e38, type: 3}
12 | m_ShaderKeywords: Cutout FADE FADEMODE_CUTOUT Fade _FADEMODE_CUTOUT
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _GradientMaskTex:
23 | m_Texture: {fileID: 2800000, guid: e87ec6eaebb7343c6a0bb3e53de305b6, type: 3}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _MainTex:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | m_Floats:
31 | - FadeMode: 1
32 | - _AlphaRate: 0.5
33 | - _ColorMask: 15
34 | - _CutoutEdgeFactor: 0.02
35 | - _FadeMode: 1
36 | - _RegularDirection: 1
37 | - _Stencil: 0
38 | - _StencilComp: 8
39 | - _StencilOp: 0
40 | - _StencilReadMask: 255
41 | - _StencilWriteMask: 255
42 | - _UseUIAlphaClip: 0
43 | m_Colors: []
44 |
--------------------------------------------------------------------------------
/Assets/UniFader/Materials/UI_GradientMaskTransition.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b793591b72b494598a45ff7c123f8cb8
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Prefabs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 487103d88011c4098ab9b2ca7d2bcfc3
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Prefabs/FadeCanvas.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &6524962257752176795
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | serializedVersion: 6
10 | m_Component:
11 | - component: {fileID: 6524962257752176774}
12 | - component: {fileID: 6524962257752176773}
13 | - component: {fileID: 6524962257752176772}
14 | m_Layer: 5
15 | m_Name: Panel
16 | m_TagString: Untagged
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!224 &6524962257752176774
22 | RectTransform:
23 | m_ObjectHideFlags: 0
24 | m_CorrespondingSourceObject: {fileID: 0}
25 | m_PrefabInstance: {fileID: 0}
26 | m_PrefabAsset: {fileID: 0}
27 | m_GameObject: {fileID: 6524962257752176795}
28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29 | m_LocalPosition: {x: 0, y: 0, z: 0}
30 | m_LocalScale: {x: 1, y: 1, z: 1}
31 | m_Children: []
32 | m_Father: {fileID: 6524962258379280615}
33 | m_RootOrder: 0
34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35 | m_AnchorMin: {x: 0, y: 0}
36 | m_AnchorMax: {x: 1, y: 1}
37 | m_AnchoredPosition: {x: 0, y: 0}
38 | m_SizeDelta: {x: 0, y: 0}
39 | m_Pivot: {x: 0.5, y: 0.5}
40 | --- !u!222 &6524962257752176773
41 | CanvasRenderer:
42 | m_ObjectHideFlags: 0
43 | m_CorrespondingSourceObject: {fileID: 0}
44 | m_PrefabInstance: {fileID: 0}
45 | m_PrefabAsset: {fileID: 0}
46 | m_GameObject: {fileID: 6524962257752176795}
47 | m_CullTransparentMesh: 0
48 | --- !u!114 &6524962257752176772
49 | MonoBehaviour:
50 | m_ObjectHideFlags: 0
51 | m_CorrespondingSourceObject: {fileID: 0}
52 | m_PrefabInstance: {fileID: 0}
53 | m_PrefabAsset: {fileID: 0}
54 | m_GameObject: {fileID: 6524962257752176795}
55 | m_Enabled: 1
56 | m_EditorHideFlags: 0
57 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
58 | m_Name:
59 | m_EditorClassIdentifier:
60 | m_Material: {fileID: 2100000, guid: b793591b72b494598a45ff7c123f8cb8, type: 2}
61 | m_Color: {r: 1, g: 1, b: 1, a: 1}
62 | m_RaycastTarget: 1
63 | m_OnCullStateChanged:
64 | m_PersistentCalls:
65 | m_Calls: []
66 | m_Sprite: {fileID: 21300000, guid: e2f8c3ce25a5640bd9f7579f8af06c8f, type: 3}
67 | m_Type: 0
68 | m_PreserveAspect: 0
69 | m_FillCenter: 1
70 | m_FillMethod: 4
71 | m_FillAmount: 1
72 | m_FillClockwise: 1
73 | m_FillOrigin: 0
74 | m_UseSpriteMesh: 0
75 | m_PixelsPerUnitMultiplier: 1
76 | --- !u!1 &6524962258379280634
77 | GameObject:
78 | m_ObjectHideFlags: 0
79 | m_CorrespondingSourceObject: {fileID: 0}
80 | m_PrefabInstance: {fileID: 0}
81 | m_PrefabAsset: {fileID: 0}
82 | serializedVersion: 6
83 | m_Component:
84 | - component: {fileID: 6524962258379280615}
85 | - component: {fileID: 6524962258379280614}
86 | - component: {fileID: 6524962258379280613}
87 | - component: {fileID: 6524962258379280612}
88 | - component: {fileID: 6524962258379280635}
89 | m_Layer: 5
90 | m_Name: FadeCanvas
91 | m_TagString: Untagged
92 | m_Icon: {fileID: 0}
93 | m_NavMeshLayer: 0
94 | m_StaticEditorFlags: 0
95 | m_IsActive: 1
96 | --- !u!224 &6524962258379280615
97 | RectTransform:
98 | m_ObjectHideFlags: 0
99 | m_CorrespondingSourceObject: {fileID: 0}
100 | m_PrefabInstance: {fileID: 0}
101 | m_PrefabAsset: {fileID: 0}
102 | m_GameObject: {fileID: 6524962258379280634}
103 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
104 | m_LocalPosition: {x: 0, y: 0, z: 0}
105 | m_LocalScale: {x: 0, y: 0, z: 0}
106 | m_Children:
107 | - {fileID: 6524962257752176774}
108 | m_Father: {fileID: 0}
109 | m_RootOrder: 0
110 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
111 | m_AnchorMin: {x: 0, y: 0}
112 | m_AnchorMax: {x: 0, y: 0}
113 | m_AnchoredPosition: {x: 0, y: 0}
114 | m_SizeDelta: {x: 0, y: 0}
115 | m_Pivot: {x: 0, y: 0}
116 | --- !u!223 &6524962258379280614
117 | Canvas:
118 | m_ObjectHideFlags: 0
119 | m_CorrespondingSourceObject: {fileID: 0}
120 | m_PrefabInstance: {fileID: 0}
121 | m_PrefabAsset: {fileID: 0}
122 | m_GameObject: {fileID: 6524962258379280634}
123 | m_Enabled: 1
124 | serializedVersion: 3
125 | m_RenderMode: 0
126 | m_Camera: {fileID: 0}
127 | m_PlaneDistance: 100
128 | m_PixelPerfect: 0
129 | m_ReceivesEvents: 1
130 | m_OverrideSorting: 0
131 | m_OverridePixelPerfect: 0
132 | m_SortingBucketNormalizedSize: 0
133 | m_AdditionalShaderChannelsFlag: 0
134 | m_SortingLayerID: 0
135 | m_SortingOrder: 10000
136 | m_TargetDisplay: 0
137 | --- !u!114 &6524962258379280613
138 | MonoBehaviour:
139 | m_ObjectHideFlags: 0
140 | m_CorrespondingSourceObject: {fileID: 0}
141 | m_PrefabInstance: {fileID: 0}
142 | m_PrefabAsset: {fileID: 0}
143 | m_GameObject: {fileID: 6524962258379280634}
144 | m_Enabled: 1
145 | m_EditorHideFlags: 0
146 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
147 | m_Name:
148 | m_EditorClassIdentifier:
149 | m_UiScaleMode: 1
150 | m_ReferencePixelsPerUnit: 100
151 | m_ScaleFactor: 1
152 | m_ReferenceResolution: {x: 1600, y: 900}
153 | m_ScreenMatchMode: 0
154 | m_MatchWidthOrHeight: 0
155 | m_PhysicalUnit: 3
156 | m_FallbackScreenDPI: 96
157 | m_DefaultSpriteDPI: 96
158 | m_DynamicPixelsPerUnit: 1
159 | --- !u!114 &6524962258379280612
160 | MonoBehaviour:
161 | m_ObjectHideFlags: 0
162 | m_CorrespondingSourceObject: {fileID: 0}
163 | m_PrefabInstance: {fileID: 0}
164 | m_PrefabAsset: {fileID: 0}
165 | m_GameObject: {fileID: 6524962258379280634}
166 | m_Enabled: 1
167 | m_EditorHideFlags: 0
168 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
169 | m_Name:
170 | m_EditorClassIdentifier:
171 | m_IgnoreReversedGraphics: 1
172 | m_BlockingObjects: 0
173 | m_BlockingMask:
174 | serializedVersion: 2
175 | m_Bits: 4294967295
176 | --- !u!114 &6524962258379280635
177 | MonoBehaviour:
178 | m_ObjectHideFlags: 0
179 | m_CorrespondingSourceObject: {fileID: 0}
180 | m_PrefabInstance: {fileID: 0}
181 | m_PrefabAsset: {fileID: 0}
182 | m_GameObject: {fileID: 6524962258379280634}
183 | m_Enabled: 1
184 | m_EditorHideFlags: 0
185 | m_Script: {fileID: 11500000, guid: 25182c06418a14ab7a1c83fc80a7f923, type: 3}
186 | m_Name:
187 | m_EditorClassIdentifier:
188 | usedAsInstance: 1
189 | fadeTarget: {fileID: 6524962257752176772}
190 | defaultDuration: 1
191 | fadeOutCurve:
192 | serializedVersion: 2
193 | m_Curve:
194 | - serializedVersion: 3
195 | time: 0
196 | value: 0
197 | inSlope: 1
198 | outSlope: 1
199 | tangentMode: 0
200 | weightedMode: 0
201 | inWeight: 0.33333334
202 | outWeight: 0.33333334
203 | - serializedVersion: 3
204 | time: 1
205 | value: 1
206 | inSlope: 1
207 | outSlope: 1
208 | tangentMode: 0
209 | weightedMode: 0
210 | inWeight: 0.33333334
211 | outWeight: 0.33333334
212 | m_PreInfinity: 2
213 | m_PostInfinity: 2
214 | m_RotationOrder: 4
215 | fadeInCurve:
216 | serializedVersion: 2
217 | m_Curve:
218 | - serializedVersion: 3
219 | time: 0
220 | value: 1
221 | inSlope: 0
222 | outSlope: -1
223 | tangentMode: 0
224 | weightedMode: 0
225 | inWeight: 0
226 | outWeight: 0
227 | - serializedVersion: 3
228 | time: 1
229 | value: 0
230 | inSlope: -1
231 | outSlope: 0
232 | tangentMode: 0
233 | weightedMode: 0
234 | inWeight: 0
235 | outWeight: 0
236 | m_PreInfinity: 2
237 | m_PostInfinity: 2
238 | m_RotationOrder: 4
239 | sortingOrder: 10000
240 | ignoreTimeScale: 0
241 | onFadeOut:
242 | m_PersistentCalls:
243 | m_Calls: []
244 | onFadeIn:
245 | m_PersistentCalls:
246 | m_Calls: []
247 | fadePattern:
248 | id: 0
249 | references:
250 | version: 1
251 | 00000000:
252 | type: {class: GradientMaskFade, ns: MB.UniFader, asm: Assembly-CSharp}
253 | data:
254 | ruleMaterial: {fileID: 2100000, guid: b793591b72b494598a45ff7c123f8cb8, type: 2}
255 | ruleTexture: {fileID: 2800000, guid: e87ec6eaebb7343c6a0bb3e53de305b6, type: 3}
256 | fadeOutInMode: 2
257 |
--------------------------------------------------------------------------------
/Assets/UniFader/Prefabs/FadeCanvas.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8569c3623587f48de9f22fbd146c1236
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1174f1c2c594f4fd1bec303f919b4219
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/FadeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using UnityEngine;
3 | using MB.UniFader;
4 |
5 | public class FadeTest : MonoBehaviour
6 | {
7 | void Update()
8 | {
9 | if (Input.GetButtonDown("Jump"))
10 | {
11 | UniFader.Instance.LoadSceneWithFade(0);
12 | }
13 | }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/FadeTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 87ffdeb2227b1499eb2e4f5c70b4f798
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Sample.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 9
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074, b: 0.35872698, a: 1}
42 | m_UseRadianceAmbientProbe: 0
43 | --- !u!157 &3
44 | LightmapSettings:
45 | m_ObjectHideFlags: 0
46 | serializedVersion: 11
47 | m_GIWorkflowMode: 0
48 | m_GISettings:
49 | serializedVersion: 2
50 | m_BounceScale: 1
51 | m_IndirectOutputScale: 1
52 | m_AlbedoBoost: 1
53 | m_EnvironmentLightingMode: 0
54 | m_EnableBakedLightmaps: 1
55 | m_EnableRealtimeLightmaps: 1
56 | m_LightmapEditorSettings:
57 | serializedVersion: 12
58 | m_Resolution: 2
59 | m_BakeResolution: 40
60 | m_AtlasSize: 1024
61 | m_AO: 0
62 | m_AOMaxDistance: 1
63 | m_CompAOExponent: 1
64 | m_CompAOExponentDirect: 0
65 | m_ExtractAmbientOcclusion: 0
66 | m_Padding: 2
67 | m_LightmapParameters: {fileID: 0}
68 | m_LightmapsBakeMode: 1
69 | m_TextureCompression: 1
70 | m_FinalGather: 0
71 | m_FinalGatherFiltering: 1
72 | m_FinalGatherRayCount: 256
73 | m_ReflectionCompression: 2
74 | m_MixedBakeMode: 2
75 | m_BakeBackend: 1
76 | m_PVRSampling: 1
77 | m_PVRDirectSampleCount: 32
78 | m_PVRSampleCount: 500
79 | m_PVRBounces: 2
80 | m_PVREnvironmentSampleCount: 500
81 | m_PVREnvironmentReferencePointCount: 2048
82 | m_PVRFilteringMode: 2
83 | m_PVRDenoiserTypeDirect: 0
84 | m_PVRDenoiserTypeIndirect: 0
85 | m_PVRDenoiserTypeAO: 0
86 | m_PVRFilterTypeDirect: 0
87 | m_PVRFilterTypeIndirect: 0
88 | m_PVRFilterTypeAO: 0
89 | m_PVREnvironmentMIS: 0
90 | m_PVRCulling: 1
91 | m_PVRFilteringGaussRadiusDirect: 1
92 | m_PVRFilteringGaussRadiusIndirect: 5
93 | m_PVRFilteringGaussRadiusAO: 2
94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
96 | m_PVRFilteringAtrousPositionSigmaAO: 1
97 | m_ExportTrainingData: 0
98 | m_TrainingDataDestination: TrainingData
99 | m_LightProbeSampleCountMultiplier: 4
100 | m_LightingDataAsset: {fileID: 0}
101 | m_UseShadowmask: 1
102 | --- !u!196 &4
103 | NavMeshSettings:
104 | serializedVersion: 2
105 | m_ObjectHideFlags: 0
106 | m_BuildSettings:
107 | serializedVersion: 2
108 | agentTypeID: 0
109 | agentRadius: 0.5
110 | agentHeight: 2
111 | agentSlope: 45
112 | agentClimb: 0.4
113 | ledgeDropHeight: 0
114 | maxJumpAcrossDistance: 0
115 | minRegionArea: 2
116 | manualCellSize: 0
117 | cellSize: 0.16666667
118 | manualTileSize: 0
119 | tileSize: 256
120 | accuratePlacement: 0
121 | debug:
122 | m_Flags: 0
123 | m_NavMeshData: {fileID: 0}
124 | --- !u!1 &254322574
125 | GameObject:
126 | m_ObjectHideFlags: 0
127 | m_CorrespondingSourceObject: {fileID: 0}
128 | m_PrefabInstance: {fileID: 0}
129 | m_PrefabAsset: {fileID: 0}
130 | serializedVersion: 6
131 | m_Component:
132 | - component: {fileID: 254322577}
133 | - component: {fileID: 254322576}
134 | - component: {fileID: 254322575}
135 | m_Layer: 0
136 | m_Name: EventSystem
137 | m_TagString: Untagged
138 | m_Icon: {fileID: 0}
139 | m_NavMeshLayer: 0
140 | m_StaticEditorFlags: 0
141 | m_IsActive: 1
142 | --- !u!114 &254322575
143 | MonoBehaviour:
144 | m_ObjectHideFlags: 0
145 | m_CorrespondingSourceObject: {fileID: 0}
146 | m_PrefabInstance: {fileID: 0}
147 | m_PrefabAsset: {fileID: 0}
148 | m_GameObject: {fileID: 254322574}
149 | m_Enabled: 1
150 | m_EditorHideFlags: 0
151 | m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
152 | m_Name:
153 | m_EditorClassIdentifier:
154 | m_HorizontalAxis: Horizontal
155 | m_VerticalAxis: Vertical
156 | m_SubmitButton: Submit
157 | m_CancelButton: Cancel
158 | m_InputActionsPerSecond: 10
159 | m_RepeatDelay: 0.5
160 | m_ForceModuleActive: 0
161 | --- !u!114 &254322576
162 | MonoBehaviour:
163 | m_ObjectHideFlags: 0
164 | m_CorrespondingSourceObject: {fileID: 0}
165 | m_PrefabInstance: {fileID: 0}
166 | m_PrefabAsset: {fileID: 0}
167 | m_GameObject: {fileID: 254322574}
168 | m_Enabled: 1
169 | m_EditorHideFlags: 0
170 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
171 | m_Name:
172 | m_EditorClassIdentifier:
173 | m_FirstSelected: {fileID: 0}
174 | m_sendNavigationEvents: 1
175 | m_DragThreshold: 10
176 | --- !u!4 &254322577
177 | Transform:
178 | m_ObjectHideFlags: 0
179 | m_CorrespondingSourceObject: {fileID: 0}
180 | m_PrefabInstance: {fileID: 0}
181 | m_PrefabAsset: {fileID: 0}
182 | m_GameObject: {fileID: 254322574}
183 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
184 | m_LocalPosition: {x: 0, y: 0, z: 0}
185 | m_LocalScale: {x: 1, y: 1, z: 1}
186 | m_Children: []
187 | m_Father: {fileID: 0}
188 | m_RootOrder: 2
189 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
190 | --- !u!1 &963194225
191 | GameObject:
192 | m_ObjectHideFlags: 0
193 | m_CorrespondingSourceObject: {fileID: 0}
194 | m_PrefabInstance: {fileID: 0}
195 | m_PrefabAsset: {fileID: 0}
196 | serializedVersion: 6
197 | m_Component:
198 | - component: {fileID: 963194228}
199 | - component: {fileID: 963194227}
200 | - component: {fileID: 963194226}
201 | m_Layer: 0
202 | m_Name: Main Camera
203 | m_TagString: MainCamera
204 | m_Icon: {fileID: 0}
205 | m_NavMeshLayer: 0
206 | m_StaticEditorFlags: 0
207 | m_IsActive: 1
208 | --- !u!81 &963194226
209 | AudioListener:
210 | m_ObjectHideFlags: 0
211 | m_CorrespondingSourceObject: {fileID: 0}
212 | m_PrefabInstance: {fileID: 0}
213 | m_PrefabAsset: {fileID: 0}
214 | m_GameObject: {fileID: 963194225}
215 | m_Enabled: 1
216 | --- !u!20 &963194227
217 | Camera:
218 | m_ObjectHideFlags: 0
219 | m_CorrespondingSourceObject: {fileID: 0}
220 | m_PrefabInstance: {fileID: 0}
221 | m_PrefabAsset: {fileID: 0}
222 | m_GameObject: {fileID: 963194225}
223 | m_Enabled: 1
224 | serializedVersion: 2
225 | m_ClearFlags: 2
226 | m_BackGroundColor: {r: 0.3962264, g: 0.3962264, b: 0.3962264, a: 0}
227 | m_projectionMatrixMode: 1
228 | m_GateFitMode: 2
229 | m_FOVAxisMode: 0
230 | m_SensorSize: {x: 36, y: 24}
231 | m_LensShift: {x: 0, y: 0}
232 | m_FocalLength: 50
233 | m_NormalizedViewPortRect:
234 | serializedVersion: 2
235 | x: 0
236 | y: 0
237 | width: 1
238 | height: 1
239 | near clip plane: 0.3
240 | far clip plane: 1000
241 | field of view: 60
242 | orthographic: 0
243 | orthographic size: 5
244 | m_Depth: -1
245 | m_CullingMask:
246 | serializedVersion: 2
247 | m_Bits: 4294967295
248 | m_RenderingPath: -1
249 | m_TargetTexture: {fileID: 0}
250 | m_TargetDisplay: 0
251 | m_TargetEye: 3
252 | m_HDR: 1
253 | m_AllowMSAA: 1
254 | m_AllowDynamicResolution: 0
255 | m_ForceIntoRT: 0
256 | m_OcclusionCulling: 1
257 | m_StereoConvergence: 10
258 | m_StereoSeparation: 0.022
259 | --- !u!4 &963194228
260 | Transform:
261 | m_ObjectHideFlags: 0
262 | m_CorrespondingSourceObject: {fileID: 0}
263 | m_PrefabInstance: {fileID: 0}
264 | m_PrefabAsset: {fileID: 0}
265 | m_GameObject: {fileID: 963194225}
266 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
267 | m_LocalPosition: {x: 0, y: 1, z: -10}
268 | m_LocalScale: {x: 1, y: 1, z: 1}
269 | m_Children: []
270 | m_Father: {fileID: 0}
271 | m_RootOrder: 0
272 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
273 | --- !u!1 &1837252146
274 | GameObject:
275 | m_ObjectHideFlags: 0
276 | m_CorrespondingSourceObject: {fileID: 0}
277 | m_PrefabInstance: {fileID: 0}
278 | m_PrefabAsset: {fileID: 0}
279 | serializedVersion: 6
280 | m_Component:
281 | - component: {fileID: 1837252148}
282 | - component: {fileID: 1837252147}
283 | m_Layer: 0
284 | m_Name: FadeTest
285 | m_TagString: Untagged
286 | m_Icon: {fileID: 0}
287 | m_NavMeshLayer: 0
288 | m_StaticEditorFlags: 0
289 | m_IsActive: 1
290 | --- !u!114 &1837252147
291 | MonoBehaviour:
292 | m_ObjectHideFlags: 0
293 | m_CorrespondingSourceObject: {fileID: 0}
294 | m_PrefabInstance: {fileID: 0}
295 | m_PrefabAsset: {fileID: 0}
296 | m_GameObject: {fileID: 1837252146}
297 | m_Enabled: 1
298 | m_EditorHideFlags: 0
299 | m_Script: {fileID: 11500000, guid: 87ffdeb2227b1499eb2e4f5c70b4f798, type: 3}
300 | m_Name:
301 | m_EditorClassIdentifier:
302 | --- !u!4 &1837252148
303 | Transform:
304 | m_ObjectHideFlags: 0
305 | m_CorrespondingSourceObject: {fileID: 0}
306 | m_PrefabInstance: {fileID: 0}
307 | m_PrefabAsset: {fileID: 0}
308 | m_GameObject: {fileID: 1837252146}
309 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
310 | m_LocalPosition: {x: 0, y: 0, z: 0}
311 | m_LocalScale: {x: 1, y: 1, z: 1}
312 | m_Children: []
313 | m_Father: {fileID: 0}
314 | m_RootOrder: 3
315 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
316 | --- !u!1001 &6524962256749068788
317 | PrefabInstance:
318 | m_ObjectHideFlags: 0
319 | serializedVersion: 2
320 | m_Modification:
321 | m_TransformParent: {fileID: 0}
322 | m_Modifications:
323 | - target: {fileID: 6524962258379280634, guid: 8569c3623587f48de9f22fbd146c1236,
324 | type: 3}
325 | propertyPath: m_Name
326 | value: FadeCanvas
327 | objectReference: {fileID: 0}
328 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
329 | type: 3}
330 | propertyPath: m_LocalPosition.x
331 | value: 0
332 | objectReference: {fileID: 0}
333 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
334 | type: 3}
335 | propertyPath: m_LocalPosition.y
336 | value: 0
337 | objectReference: {fileID: 0}
338 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
339 | type: 3}
340 | propertyPath: m_LocalPosition.z
341 | value: 0
342 | objectReference: {fileID: 0}
343 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
344 | type: 3}
345 | propertyPath: m_LocalRotation.x
346 | value: 0
347 | objectReference: {fileID: 0}
348 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
349 | type: 3}
350 | propertyPath: m_LocalRotation.y
351 | value: 0
352 | objectReference: {fileID: 0}
353 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
354 | type: 3}
355 | propertyPath: m_LocalRotation.z
356 | value: 0
357 | objectReference: {fileID: 0}
358 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
359 | type: 3}
360 | propertyPath: m_LocalRotation.w
361 | value: 1
362 | objectReference: {fileID: 0}
363 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
364 | type: 3}
365 | propertyPath: m_RootOrder
366 | value: 1
367 | objectReference: {fileID: 0}
368 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
369 | type: 3}
370 | propertyPath: m_LocalEulerAnglesHint.x
371 | value: 0
372 | objectReference: {fileID: 0}
373 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
374 | type: 3}
375 | propertyPath: m_LocalEulerAnglesHint.y
376 | value: 0
377 | objectReference: {fileID: 0}
378 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
379 | type: 3}
380 | propertyPath: m_LocalEulerAnglesHint.z
381 | value: 0
382 | objectReference: {fileID: 0}
383 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
384 | type: 3}
385 | propertyPath: m_AnchoredPosition.x
386 | value: 0
387 | objectReference: {fileID: 0}
388 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
389 | type: 3}
390 | propertyPath: m_AnchoredPosition.y
391 | value: 0
392 | objectReference: {fileID: 0}
393 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
394 | type: 3}
395 | propertyPath: m_SizeDelta.x
396 | value: 0
397 | objectReference: {fileID: 0}
398 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
399 | type: 3}
400 | propertyPath: m_SizeDelta.y
401 | value: 0
402 | objectReference: {fileID: 0}
403 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
404 | type: 3}
405 | propertyPath: m_AnchorMin.x
406 | value: 0
407 | objectReference: {fileID: 0}
408 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
409 | type: 3}
410 | propertyPath: m_AnchorMin.y
411 | value: 0
412 | objectReference: {fileID: 0}
413 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
414 | type: 3}
415 | propertyPath: m_AnchorMax.x
416 | value: 0
417 | objectReference: {fileID: 0}
418 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
419 | type: 3}
420 | propertyPath: m_AnchorMax.y
421 | value: 0
422 | objectReference: {fileID: 0}
423 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
424 | type: 3}
425 | propertyPath: m_Pivot.x
426 | value: 0
427 | objectReference: {fileID: 0}
428 | - target: {fileID: 6524962258379280615, guid: 8569c3623587f48de9f22fbd146c1236,
429 | type: 3}
430 | propertyPath: m_Pivot.y
431 | value: 0
432 | objectReference: {fileID: 0}
433 | m_RemovedComponents: []
434 | m_SourcePrefab: {fileID: 100100000, guid: 8569c3623587f48de9f22fbd146c1236, type: 3}
435 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Sample.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9fc0d4010bbf28b4594072e72b8655ab
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c35a0a5bda20d456d9fa34697cfcf776
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/Readme.txt:
--------------------------------------------------------------------------------
1 | # License
2 |
3 | unitychan_hbd.jpg
4 | © Unity Technologies Japan/UCL
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/Readme.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5ccc07991415e4b56b3467da24ba6935
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 527ab3af1d01241ddb44c8c9fbfa6813
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_circle.png
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_circle.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 986a9ce97243c409d8211f3d7bfbdf73
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 2
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_diamond.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_diamond.png
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_diamond.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0a8a38232dfb64e8d931267edf4fd8bc
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 2
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_horizontal.png
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_horizontal.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e87ec6eaebb7343c6a0bb3e53de305b6
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 2
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_rotate.png
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_rotate.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 177c66bdce0194ebda152b25d4ba4e56
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 2
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_vertical.png
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/SampleGradientMasks/rule_vertical.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 10f11773287e848e689606f0d0e56685
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 2
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/unitychan_hbd.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gok11/UniFader/df453e965e99c9eace58cd757c8f17efd36ef68d/Assets/UniFader/Sample/Textures/unitychan_hbd.jpg
--------------------------------------------------------------------------------
/Assets/UniFader/Sample/Textures/unitychan_hbd.jpg.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e2f8c3ce25a5640bd9f7579f8af06c8f
3 | TextureImporter:
4 | internalIDToNameTable: []
5 | externalObjects: {}
6 | serializedVersion: 10
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 0
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: 1
38 | wrapV: 1
39 | wrapW: -1
40 | nPOTScale: 0
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 1
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 1
53 | spriteTessellationDetail: -1
54 | textureType: 8
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 3
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | forceMaximumCompressionQuality_BC6H_BC7: 0
73 | - serializedVersion: 3
74 | buildTarget: Standalone
75 | maxTextureSize: 2048
76 | resizeAlgorithm: 0
77 | textureFormat: -1
78 | textureCompression: 1
79 | compressionQuality: 50
80 | crunchedCompression: 0
81 | allowsAlphaSplitting: 0
82 | overridden: 0
83 | androidETC2FallbackOverride: 0
84 | forceMaximumCompressionQuality_BC6H_BC7: 0
85 | spriteSheet:
86 | serializedVersion: 2
87 | sprites: []
88 | outline: []
89 | physicsShape: []
90 | bones: []
91 | spriteID: 5e97eb03825dee720800000000000000
92 | internalID: 0
93 | vertices: []
94 | indices:
95 | edges: []
96 | weights: []
97 | secondaryTextures: []
98 | spritePackingTag:
99 | pSDRemoveMatte: 0
100 | pSDShowRemoveMatteOption: 0
101 | userData:
102 | assetBundleName:
103 | assetBundleVariant:
104 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 055163d25fd6c44f094dd034d21b7f86
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f86998d2652ad476796b545d3824c686
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/CustomSerializeReferenceDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace MB.UniFader
4 | {
5 | public class CustomSerializeReferenceDrawer : Attribute
6 | {
7 | public Type type;
8 |
9 | public CustomSerializeReferenceDrawer(Type type)
10 | {
11 | this.type = type;
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/CustomSerializeReferenceDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 58e70e263a3b74213a97ce7a74fcdef1
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/GradientMaskFadeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 | using UnityEngine.UI;
5 |
6 | namespace MB.UniFader
7 | {
8 | [CustomSerializeReferenceDrawer(typeof(GradientMaskFade))]
9 | public class GradientMaskFadeDrawer : PropertyDrawer
10 | {
11 | private static readonly int FadeMode = Shader.PropertyToID("_FadeMode");
12 | private static readonly int AlphaRate = Shader.PropertyToID("_AlphaRate");
13 | private static readonly int RegularDirection = Shader.PropertyToID("_RegularDirection");
14 | private static readonly int GradientMaskTex = Shader.PropertyToID("GradientMaskTex");
15 | private static readonly int CutoutEdgeFactor = Shader.PropertyToID("_CutoutEdgeFactor");
16 |
17 | private enum TransitionMode
18 | {
19 | Fade, Cutout
20 | }
21 |
22 | private float LineHeight => EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
23 |
24 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
25 | {
26 | var ruleMaterial = property.FindPropertyRelative("ruleMaterial");
27 | var ruleTexture = property.FindPropertyRelative("ruleTexture");
28 | var fadeOutInMode = property.FindPropertyRelative("fadeOutInMode");
29 | var ruleMaterialObj = (ruleMaterial.objectReferenceValue as System.Object) as Material;
30 |
31 | var fieldRect = position;
32 | fieldRect.height = EditorGUIUtility.singleLineHeight;
33 |
34 | // Set material
35 | fieldRect.y += LineHeight;
36 | EditorGUI.BeginChangeCheck();
37 | EditorGUI.PropertyField(fieldRect, ruleMaterial, new GUIContent("Transition Material"));
38 | if (EditorGUI.EndChangeCheck())
39 | {
40 | var fadeTarget = property.serializedObject.FindProperty("fadeTarget");
41 | var image = (fadeTarget.objectReferenceValue as System.Object) as Image;
42 | image.material = (ruleMaterial.objectReferenceValue as System.Object) as Material;
43 | }
44 |
45 | // Set texture
46 | fieldRect.y += LineHeight;
47 | //var prevTexture = ruleTexture.objectReferenceValue;
48 | EditorGUI.BeginChangeCheck();
49 | EditorGUI.PropertyField(fieldRect, ruleTexture, new GUIContent("Mask Texture"));
50 | if (EditorGUI.EndChangeCheck() && ruleMaterialObj != null)
51 | {
52 | ruleMaterialObj.SetTexture(GradientMaskTex, ruleTexture.objectReferenceValue as Texture);
53 | }
54 |
55 | // -- draw transition mode --
56 | fieldRect.y += LineHeight;
57 | GUI.enabled = ruleMaterialObj != null;
58 |
59 | var transitionModeRect = fieldRect;
60 | EditorGUI.PrefixLabel(transitionModeRect, new GUIContent("Transition Mode"));
61 |
62 | transitionModeRect.x += EditorGUIUtility.labelWidth + 2;
63 | transitionModeRect.width -= EditorGUIUtility.labelWidth + 2;
64 |
65 | if (ruleMaterialObj != null)
66 | {
67 | // set transition mode
68 | var prevMode = (TransitionMode) ruleMaterialObj.GetInt(FadeMode);
69 | var newMode =
70 | (TransitionMode) EditorGUI.EnumPopup(transitionModeRect, (TransitionMode) ruleMaterialObj.GetInt(FadeMode));
71 | if (prevMode != newMode)
72 | {
73 | Undo.RecordObject(ruleMaterialObj, "Edit Transition Mode");
74 | ruleMaterialObj.SetInt(FadeMode, (int) newMode);
75 |
76 | // update material keyword
77 | var values = Enum.GetValues(typeof(TransitionMode));
78 | foreach (var value in values)
79 | {
80 | if ((int)value == (int) newMode)
81 | {
82 | ruleMaterialObj.EnableKeyword("_FADEMODE_" + newMode.ToString().ToUpper());
83 | }
84 | else
85 | {
86 | var disabledName = Enum.GetName(typeof(TransitionMode), value);
87 | ruleMaterialObj.DisableKeyword("_FADEMODE_" + disabledName.ToUpper());
88 | }
89 | }
90 | }
91 |
92 | // Set cutout edge factor
93 | if ((TransitionMode) ruleMaterialObj.GetInt(FadeMode) == TransitionMode.Cutout)
94 | {
95 | fieldRect.y += LineHeight;
96 |
97 | var edgeFactor = ruleMaterialObj.GetFloat(CutoutEdgeFactor);
98 |
99 | EditorGUI.BeginChangeCheck();
100 | var newFactor = EditorGUI.Slider(fieldRect, new GUIContent("Cutout Edge Smoothness"),
101 | edgeFactor, 0, 0.1f);
102 | if (EditorGUI.EndChangeCheck())
103 | {
104 | Undo.RecordObject(ruleMaterialObj, "Edit Edge Factor");
105 | ruleMaterialObj.SetFloat(CutoutEdgeFactor, newFactor);
106 | }
107 | }
108 | }
109 | else
110 | {
111 | // only showing button
112 | GUI.Button(transitionModeRect, "Fade", "MiniPopup");
113 | }
114 |
115 | // EnumPopup in SerializeReferenced interface doesn't work on 2019.3
116 | fieldRect.y += LineHeight;
117 | fadeOutInMode.intValue = (int) (GradientMaskFade.FadeOutInMode) EditorGUI.EnumPopup(
118 | fieldRect, "Fade Out In Mode",
119 | (GradientMaskFade.FadeOutInMode) fadeOutInMode.intValue);
120 |
121 | // debug function
122 | fieldRect.y += LineHeight;
123 | var boxRect = fieldRect;
124 | boxRect.height *= 2;
125 | GUI.Box(boxRect, "");
126 |
127 | var alphaRateRect = fieldRect;
128 | alphaRateRect.x += 2;
129 | GUI.Label(alphaRateRect, new GUIContent("Debug"), EditorStyles.boldLabel); // EditorGUI.PrefixLabel doesn't work correctly
130 |
131 | alphaRateRect.y += LineHeight;
132 | alphaRateRect.width -= 4;
133 | if (ruleMaterialObj != null)
134 | {
135 | var currentRate = ruleMaterialObj.GetFloat(AlphaRate);
136 | EditorGUI.BeginChangeCheck();
137 | var newRate = EditorGUI.Slider(alphaRateRect, new GUIContent("Alpha Rate"), currentRate, 0, 1f);
138 | if (currentRate != newRate)
139 | {
140 | Undo.RecordObject(ruleMaterialObj, "Edit Fade Values");
141 | var direction = CalcDirection((GradientMaskFade.FadeOutInMode) fadeOutInMode.intValue);
142 | ruleMaterialObj.SetFloat(RegularDirection, direction);
143 | ruleMaterialObj.SetFloat(AlphaRate, newRate);
144 | }
145 | }
146 | else
147 | {
148 | EditorGUI.Slider(alphaRateRect, new GUIContent("Alpha Rate"), 0, 0, 1f);
149 | }
150 |
151 | GUI.enabled = true;
152 | }
153 |
154 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
155 | {
156 | var height = LineHeight * 4; // 4 props
157 | height += LineHeight * 2; // debug height
158 |
159 | var ruleMaterial = property.FindPropertyRelative("ruleMaterial");
160 | var ruleMaterialObj = (ruleMaterial.objectReferenceValue as System.Object) as Material;
161 |
162 | if (ruleMaterialObj &&
163 | (TransitionMode) ruleMaterialObj.GetInt(FadeMode) == TransitionMode.Cutout)
164 | {
165 | height += LineHeight;
166 | }
167 |
168 | return height;
169 | }
170 |
171 | private int CalcDirection(GradientMaskFade.FadeOutInMode fadeOutInMode)
172 | {
173 | var direction = 0;
174 |
175 | switch (fadeOutInMode)
176 | {
177 | case GradientMaskFade.FadeOutInMode.Yoyo:
178 | case GradientMaskFade.FadeOutInMode.RepeatTwice:
179 | direction = 0;
180 | break;
181 |
182 | case GradientMaskFade.FadeOutInMode.InvertYoyo:
183 | case GradientMaskFade.FadeOutInMode.InvertRepeatTwice:
184 | direction = 1;
185 | break;
186 | }
187 |
188 | return direction;
189 | }
190 | }
191 | }
192 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/GradientMaskFadeDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e68bad77b4d274d5f82a90a3b9a05597
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/UniFaderEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using UnityEditor;
5 | using UnityEngine;
6 | using UnityEngine.UI;
7 |
8 | namespace MB.UniFader
9 | {
10 | [CustomEditor(typeof(UniFader))]
11 | public class UniFaderEditor : Editor
12 | {
13 | private SerializedProperty m_Script;
14 | private SerializedProperty usedAsInstance;
15 | private SerializedProperty fadeTarget;
16 | private SerializedProperty defaultDuration;
17 | private SerializedProperty fadeOutCurve;
18 | private SerializedProperty fadeInCurve;
19 | private SerializedProperty sortingOrder;
20 | private SerializedProperty ignoreTimeScale;
21 | private SerializedProperty onFadeOut;
22 | private SerializedProperty onFadeIn;
23 | private SerializedProperty fadePattern;
24 |
25 | private FadeMode fadeMode = FadeMode.FadeOutIn;
26 | private Dictionary serializeDrawerDictionary;
27 |
28 | void OnEnable()
29 | {
30 | m_Script = serializedObject.FindProperty("m_Script");
31 | usedAsInstance = serializedObject.FindProperty("usedAsInstance");
32 | fadeTarget = serializedObject.FindProperty("fadeTarget");
33 | defaultDuration = serializedObject.FindProperty("defaultDuration");
34 | fadeOutCurve = serializedObject.FindProperty("fadeOutCurve");
35 | fadeInCurve = serializedObject.FindProperty("fadeInCurve");
36 | sortingOrder = serializedObject.FindProperty("sortingOrder");
37 | ignoreTimeScale = serializedObject.FindProperty("ignoreTimeScale");
38 | onFadeOut = serializedObject.FindProperty("onFadeOut");
39 | onFadeIn = serializedObject.FindProperty("onFadeIn");
40 | fadePattern = serializedObject.FindProperty("fadePattern");
41 | }
42 |
43 | public override void OnInspectorGUI()
44 | {
45 | serializedObject.Update();
46 |
47 | var uniFader = serializedObject.targetObject as UniFader;
48 |
49 | using (new EditorGUI.DisabledScope(true))
50 | {
51 | EditorGUILayout.PropertyField(m_Script);
52 | }
53 |
54 | EditorGUILayout.PropertyField(usedAsInstance);
55 |
56 | if (CheckIfMultiFaderHasDefaultSettings())
57 | {
58 | EditorGUILayout.HelpBox("There are some UniFader marked as \"Used By Default\". One of them is used by static functions at random.", MessageType.Warning);
59 | }
60 |
61 | EditorGUILayout.PropertyField(fadeTarget);
62 | EditorGUILayout.PropertyField(defaultDuration);
63 |
64 | using (new EditorGUILayout.HorizontalScope())
65 | {
66 | EditorGUILayout.PropertyField(fadeOutCurve);
67 | ShowContextButton("Copy Mirror Curve To Fade In", fadeOutCurve);
68 | }
69 |
70 | using (new EditorGUILayout.HorizontalScope())
71 | {
72 | EditorGUILayout.PropertyField(fadeInCurve);
73 | ShowContextButton("Copy Mirror Curve To Fade Out", fadeInCurve);
74 | }
75 |
76 | EditorGUILayout.PropertyField(sortingOrder);
77 | EditorGUILayout.PropertyField(ignoreTimeScale);
78 |
79 | DrawUtility.DrawSeparator(3);
80 |
81 | // create fade pattern menu
82 | using (new EditorGUILayout.HorizontalScope())
83 | {
84 | EditorGUILayout.PrefixLabel("Fade Pattern");
85 | if (GUILayout.Button(fadePattern.type, "MiniPopup"))
86 | {
87 | var menu = new GenericMenu();
88 | var names = TypeUtility.GetAllFadePatternNames();
89 |
90 | for (var i = 0; i < names.Length; ++i)
91 | {
92 | var idx = i;
93 | menu.AddItem(new GUIContent(names[i]), false,
94 | () =>
95 | {
96 | if (fadePattern.type == names[idx]) return;
97 |
98 | // Type.GetType doesn't work
99 | Undo.RegisterCompleteObjectUndo(uniFader, "Change Fade Pattern");
100 | var fadeType = TypeUtility.GetTypeByName(names[idx]);
101 | var fadeInstance = (IFadePattern)Activator.CreateInstance(fadeType);
102 | uniFader.FadePattern = fadeInstance;
103 |
104 | var image = (fadeTarget.objectReferenceValue as System.Object) as Image;
105 | image.material = null;
106 | });
107 | }
108 | menu.ShowAsContext();
109 | }
110 | }
111 |
112 | DrawFaderItem(fadePattern);
113 |
114 | // Draw preview button
115 | using (new EditorGUILayout.VerticalScope("box"))
116 | {
117 | var titleLabel = Application.isPlaying ? "Debug" : "Debug (Runtime Only)";
118 | GUILayout.Label(titleLabel, EditorStyles.boldLabel);
119 |
120 | EditorGUI.BeginDisabledGroup(!Application.isPlaying);
121 | EditorGUILayout.BeginHorizontal();
122 |
123 | if (GUILayout.Button("Preview:", GUILayout.Width(EditorGUIUtility.labelWidth)))
124 | {
125 | switch (fadeMode)
126 | {
127 | case FadeMode.FadeIn: uniFader.FadeIn(); break;
128 | case FadeMode.FadeOut: uniFader.FadeOut(); break;
129 | case FadeMode.FadeInOut: uniFader.FadeIn(() => uniFader.FadeOut()); break;
130 | case FadeMode.FadeOutIn: uniFader.FadeOut(() => uniFader.FadeIn()); break;
131 | }
132 | }
133 |
134 | fadeMode = (FadeMode)EditorGUILayout.EnumPopup(fadeMode);
135 |
136 | EditorGUI.EndDisabledGroup();
137 | EditorGUILayout.EndHorizontal();
138 | }
139 |
140 | EditorGUILayout.PropertyField(onFadeOut);
141 | EditorGUILayout.PropertyField(onFadeIn);
142 |
143 | serializedObject.ApplyModifiedProperties();
144 | }
145 |
146 | bool CheckIfMultiFaderHasDefaultSettings()
147 | {
148 | var faderHasUsedByDefaultCount =
149 | FindObjectsOfType().Count(t => t.UsedAsInstance);
150 | return faderHasUsedByDefaultCount > 1;
151 | }
152 |
153 | void ShowContextButton(string itemContent, SerializedProperty baseCurve)
154 | {
155 | if (GUILayout.Button("…", GUILayout.Width(30)))
156 | {
157 | var uniFader = serializedObject.targetObject as UniFader;
158 |
159 | var menu = new GenericMenu();
160 |
161 | // add reversed copy button
162 | menu.AddItem(new GUIContent(itemContent), false, () =>
163 | {
164 | // https://issuetracker.unity3d.com/issues/animationcurve-value-cannot-be-changed-in-custom-inspector-when-it-is-accessed-as-serialized-propertys-animationcurvevalue
165 | var fader = serializedObject.targetObject as UniFader;
166 |
167 | var baseKeys = baseCurve.animationCurveValue.keys;
168 | var keyLength = baseKeys.Length;
169 | var newKeys = new Keyframe[keyLength];
170 |
171 | for (int i = 0; i < keyLength; ++i)
172 | {
173 | newKeys[i].time = baseKeys[i].time;
174 | newKeys[i].value = baseKeys[keyLength - 1 - i].value;
175 |
176 | newKeys[i].inWeight = baseKeys[keyLength - 1 - i].outWeight;
177 | newKeys[i].outWeight = baseKeys[keyLength - 1 - i].inWeight;
178 |
179 | newKeys[i].inTangent = baseKeys[keyLength - 1 - i].outTangent * -1;
180 | newKeys[i].outTangent = baseKeys[keyLength - 1 - i].inTangent * -1;
181 | }
182 |
183 | var newCurve = new AnimationCurve(newKeys);
184 |
185 | if (baseCurve.name == "fadeOutCurve")
186 | uniFader.FadeInCurve = newCurve;
187 | else
188 | uniFader.FadeOutCurve = newCurve;
189 |
190 | // force update animation curve
191 | AssetDatabase.Refresh();
192 | });
193 |
194 | // add reset button
195 | menu.AddItem(new GUIContent("Reset"), false, () =>
196 | {
197 | // https://issuetracker.unity3d.com/issues/animationcurve-value-cannot-be-changed-in-custom-inspector-when-it-is-accessed-as-serialized-propertys-animationcurvevalue
198 | var fader = serializedObject.targetObject as UniFader;
199 |
200 | if (baseCurve.name == "fadeOutCurve")
201 | uniFader.FadeOutCurve = AnimationCurve.Linear(0, 0, 1, 1);
202 | else
203 | uniFader.FadeInCurve = AnimationCurve.Linear(0, 1, 1, 0);
204 |
205 | // force update animation curve
206 | AssetDatabase.Refresh();
207 | });
208 |
209 | menu.ShowAsContext();
210 | }
211 | }
212 |
213 | void DrawFaderItem(SerializedProperty prop)
214 | {
215 | // CustomPropertyDrawer in SerializeReferenced interface seems not worked on 2019.3...(?)
216 | if (serializeDrawerDictionary == null)
217 | {
218 | serializeDrawerDictionary = TypeUtility.GetTypeDictWithCustomDrawerAttribute();
219 | }
220 |
221 | var drawerType = serializeDrawerDictionary.ContainsKey(fadePattern.type)
222 | ? serializeDrawerDictionary[fadePattern.type] : null;
223 |
224 | if (drawerType != null)
225 | {
226 | var drawer = (PropertyDrawer)Activator.CreateInstance(drawerType);
227 | drawer.OnGUI(GUILayoutUtility.GetLastRect(), prop, null);
228 | EditorGUILayout.Space(drawer.GetPropertyHeight(prop, null));
229 | }
230 | else
231 | {
232 | var fadeContent = prop.Copy();
233 | while (fadeContent.NextVisible(true))
234 | {
235 | EditorGUILayout.PropertyField(fadeContent, true);
236 | }
237 | }
238 | }
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/UniFaderEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5e14c6559f8f47f687f2acf346ba636
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/Utility.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 906086dbaa65244e0837acd97e44529f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/Utility/DrawUtility.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace MB.UniFader
4 | {
5 | public class DrawUtility
6 | {
7 | public static void DrawSeparator(float height)
8 | {
9 | GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(height));
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/Utility/DrawUtility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9496cb30ad60c4ff59c67fdefa9603ef
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/Utility/TypeUtility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace MB.UniFader
6 | {
7 | public class TypeUtility
8 | {
9 | public static Dictionary GetTypeDictWithCustomDrawerAttribute()
10 | {
11 | var drawerDict = new Dictionary();
12 |
13 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
14 | {
15 | foreach (var type in assembly.GetTypes())
16 | {
17 | if (type.GetCustomAttributes(typeof(CustomSerializeReferenceDrawer), false).Length <= 0)
18 | continue;
19 |
20 | var drawer = (CustomSerializeReferenceDrawer) Attribute.GetCustomAttribute(type, typeof(CustomSerializeReferenceDrawer));
21 | drawerDict.Add(drawer.type.Name, type);
22 | }
23 | }
24 |
25 | return drawerDict;
26 | }
27 |
28 | // Type.GetType doesn't work on Unity
29 | public static Type GetTypeByName(string className)
30 | {
31 | return AppDomain.CurrentDomain.GetAssemblies()
32 | .SelectMany(assembly => assembly.GetTypes())
33 | .FirstOrDefault(type => type.Name == className);
34 | }
35 |
36 | public static string[] GetAllFadePatternNames() where T : class
37 | {
38 | var allFadePatternNames = new List();
39 |
40 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
41 | {
42 | var types = assembly.GetTypes()
43 | .Where(t => t != typeof(T))
44 | .Where(t => typeof(T).IsAssignableFrom(t))
45 | .Select(t => t.Name);
46 | allFadePatternNames.AddRange(types);
47 | }
48 |
49 | return allFadePatternNames.ToArray();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/Editor/Utility/TypeUtility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 35be0b4acd4804b399a5620982fc9eb4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: da1f41e922fb64f9f91b82711f7126fc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/ColorFade.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UI;
3 |
4 | namespace MB.UniFader
5 | {
6 | public class ColorFade : IFadePattern
7 | {
8 | [SerializeField] private Color backgroundColor = Color.white;
9 | private Image target;
10 |
11 | public ColorFade () {}
12 |
13 | public ColorFade(Color backgroundColor)
14 | {
15 | this.backgroundColor = backgroundColor;
16 | }
17 |
18 | public void Initialize(Image targetImage)
19 | {
20 | target = targetImage;
21 | target.color = backgroundColor;
22 | }
23 |
24 | public void ExecFade(float progress, bool fadeOut)
25 | {
26 | target.SetImageAlpha(progress);
27 | }
28 | }
29 |
30 | static class ImageExtensions
31 | {
32 | public static void SetImageAlpha(this Image target, float alpha)
33 | {
34 | var c = target.color;
35 | c.a = alpha;
36 | target.color = c;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/ColorFade.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8891f962c62164e958c744251b4e2949
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/GradientMaskFade.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.UI;
4 |
5 | namespace MB.UniFader
6 | {
7 | public class GradientMaskFade : IFadePattern
8 | {
9 | [SerializeField] private Material ruleMaterial;
10 | [SerializeField] private Texture2D ruleTexture = null;
11 | [SerializeField] private FadeOutInMode fadeOutInMode = FadeOutInMode.Yoyo;
12 |
13 | public enum FadeOutInMode
14 | {
15 | Yoyo,
16 | InvertYoyo,
17 | RepeatTwice,
18 | InvertRepeatTwice
19 | }
20 |
21 | private static readonly int AlphaRate = Shader.PropertyToID("_AlphaRate");
22 | private static readonly int RegularDirection = Shader.PropertyToID("_RegularDirection");
23 | private static readonly int GradientMaskTex = Shader.PropertyToID("_GradientMaskTex");
24 |
25 | public GradientMaskFade() {}
26 |
27 | public GradientMaskFade(Material ruleMaterial)
28 | {
29 | this.ruleMaterial = ruleMaterial;
30 | }
31 |
32 | public void Initialize(Image targetImage)
33 | {
34 | if (!ruleMaterial || !ruleTexture) return;
35 |
36 | targetImage.material = ruleMaterial;
37 | ruleMaterial.SetTexture(GradientMaskTex, ruleTexture);
38 | }
39 |
40 | public void ExecFade(float progress, bool fadeOut)
41 | {
42 | if (!ruleMaterial || !ruleTexture)
43 | {
44 | throw new NullReferenceException("should set Gradient material and texture in Scene Fader");
45 | }
46 |
47 | var direction = CalcDirection(fadeOut);
48 | ruleMaterial.SetFloat(RegularDirection, direction);
49 | ruleMaterial.SetFloat(AlphaRate, progress);
50 | }
51 |
52 | private int CalcDirection(bool fadeOut)
53 | {
54 | var direction = 0;
55 |
56 | switch (fadeOutInMode)
57 | {
58 | case FadeOutInMode.Yoyo:
59 | direction = 0;
60 | break;
61 |
62 | case FadeOutInMode.InvertYoyo:
63 | direction = 1;
64 | break;
65 |
66 | case FadeOutInMode.RepeatTwice:
67 | direction = fadeOut ? 0 : 1;
68 | break;
69 |
70 | case FadeOutInMode.InvertRepeatTwice:
71 | direction = fadeOut ? 1 : 0;
72 | break;
73 | }
74 |
75 | return direction;
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/GradientMaskFade.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f88f6d2dc97db4a299ba8d87e3ab7a72
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/IFadePatern.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.UI;
2 |
3 | namespace MB.UniFader
4 | {
5 | public interface IFadePattern
6 | {
7 | void Initialize(Image targetImage);
8 | void ExecFade(float progress, bool fadeOut);
9 | }
10 | }
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/FadePatterns/IFadePatern.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 087c4cd88be774a618e42c1b6b0997e5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/UniFader/Scripts/UniFader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Linq;
4 | using UnityEngine;
5 | using UnityEngine.Events;
6 | using UnityEngine.UI;
7 | using UnityEngine.SceneManagement;
8 |
9 | namespace MB.UniFader
10 | {
11 | public enum FadeMode
12 | {
13 | FadeIn,
14 | FadeOut,
15 | FadeInOut,
16 | FadeOutIn
17 | }
18 |
19 | [ExecuteAlways]
20 | public class UniFader : MonoBehaviour
21 | {
22 | private Canvas canvas;
23 |
24 | [Tooltip("If this is enabled, this fader is used by static functions")]
25 | [SerializeField] private bool usedAsInstance = true;
26 |
27 | [SerializeField] private Image fadeTarget;
28 | [SerializeField] private float defaultDuration = 1f;
29 | [SerializeField] private AnimationCurve fadeOutCurve = AnimationCurve.Linear(0, 0, 1, 1);
30 | [SerializeField] private AnimationCurve fadeInCurve = AnimationCurve.Linear(0, 1, 1, 0);
31 | [SerializeField] private int sortingOrder = 10000;
32 | [SerializeField] private bool ignoreTimeScale = false;
33 |
34 | [SerializeField] private UnityEvent onFadeOut = new UnityEvent();
35 | [SerializeField] private UnityEvent onFadeIn = new UnityEvent();
36 |
37 | [SerializeReference] private IFadePattern fadePattern = new ColorFade();
38 |
39 | public bool UsedAsInstance => usedAsInstance;
40 |
41 | public Image FadeTarget
42 | {
43 | get => fadeTarget;
44 | set => fadeTarget = value;
45 | }
46 |
47 | public Sprite FadeContentSprite
48 | {
49 | set => fadeTarget.sprite = value;
50 | }
51 |
52 | public AnimationCurve FadeOutCurve
53 | {
54 | get => fadeOutCurve;
55 | set => fadeOutCurve = value;
56 | }
57 |
58 | public AnimationCurve FadeInCurve
59 | {
60 | get => fadeInCurve;
61 | set => fadeInCurve = value;
62 | }
63 |
64 | public int SortingOrder
65 | {
66 | get => sortingOrder;
67 | set => sortingOrder = value;
68 | }
69 |
70 | public bool IgnoreTimeScale
71 | {
72 | get => ignoreTimeScale;
73 | set => ignoreTimeScale = value;
74 | }
75 |
76 | public UnityEvent OnFadeOut
77 | {
78 | get => onFadeOut;
79 | set => onFadeOut = value;
80 | }
81 |
82 | public UnityEvent OnFadeIn
83 | {
84 | get => onFadeIn;
85 | set => onFadeIn = value;
86 | }
87 |
88 | public IFadePattern FadePattern
89 | {
90 | set
91 | {
92 | fadePattern = value;
93 | if (fadeTarget)
94 | fadePattern.Initialize(fadeTarget);
95 | }
96 | }
97 |
98 | public static UniFader Instance
99 | {
100 | get
101 | {
102 | if (_instance) return _instance;
103 |
104 | _instance = FindObjectsOfType()
105 | .FirstOrDefault(t => t.fadeTarget && t.usedAsInstance);
106 | if (_instance) return _instance;
107 |
108 | _instance = new GameObject("UniFader").AddComponent();
109 | return _instance;
110 | }
111 | }
112 | private static UniFader _instance;
113 | private bool isFading = false;
114 |
115 | void Awake()
116 | {
117 | InitializeFadeTarget();
118 | }
119 |
120 | void OnValidate()
121 | {
122 | if (canvas) canvas.sortingOrder = sortingOrder;
123 | if (fadePattern != null && fadeTarget)
124 | fadePattern.Initialize(fadeTarget);
125 | }
126 |
127 | ///
128 | /// Initialization.
129 | /// Create fade target panel and set color.
130 | ///
131 | void InitializeFadeTarget()
132 | {
133 |
134 | if (!fadeTarget)
135 | {
136 | canvas = new GameObject("FadeCanvas").AddComponent