mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-20 01:42:37 +08:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a2c550c523 | |||
| 44cf12173f | |||
| d7abcc47f1 | |||
| 57031c3e3c | |||
| cd68b364c4 | |||
| f3da972c0c | |||
| 2d6f7ed63d | |||
| 70937d2ce3 | |||
| 4a4e50e01f | |||
| 815162eab9 | |||
| 7fc0c7364d | |||
| 20e7f2fa61 | |||
| 1b292febb7 | |||
| 6b79864a39 | |||
| 4e30651290 | |||
| 87760570ec | |||
| ef7ac0aaad | |||
| 2fd87e909a | |||
| 2cc5c5b68e | |||
| 4a8d341625 |
@@ -22,7 +22,7 @@ jobs:
|
||||
find _site -name __MACOSX | xargs rm -rf
|
||||
|
||||
- name: 📦 Upload '_site'
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
|
||||
- name: 🚀 Deploy To GitHub Pages
|
||||
uses: actions/deploy-pages@v4
|
||||
uses: actions/deploy-pages@v5
|
||||
|
||||
@@ -25,10 +25,10 @@ jobs:
|
||||
tag: ${{ steps.release.outputs.new_release_git_tag }}
|
||||
steps:
|
||||
- name: 🚚 Checkout (${{ github.ref_name }})
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 🔖 Run semantic release
|
||||
uses: cycjimmy/semantic-release-action@v4
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
id: release
|
||||
with:
|
||||
working_directory: Packages/src
|
||||
|
||||
@@ -46,9 +46,9 @@ jobs:
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all --ignore-alpha`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json --ignore-alpha`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -72,11 +72,11 @@ jobs:
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 🚚 Checkout pull request (pull_request_target)
|
||||
if: github.event_name == 'pull_request_target'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
git log --oneline -n 10
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@main
|
||||
uses: game-ci/unity-builder@v5
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
@@ -46,9 +46,9 @@ jobs:
|
||||
id: setup
|
||||
run: |
|
||||
echo "==== Target Unity Versions ===="
|
||||
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all`
|
||||
LATEST_VERSIONS=`npx unity-changeset@latest list --versions --latest-patch --min ${MINIMUM_VERSION} --json --all --ignore-alpha`
|
||||
if [ "${{ inputs.usePeriodVersions }}" = "true" ]; then
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json`
|
||||
ADDITIONAL_VERSIONS=`npx unity-changeset list --versions --grep '0f' --min ${MINIMUM_VERSION} --json --ignore-alpha`
|
||||
else
|
||||
ADDITIONAL_VERSIONS=[]
|
||||
fi
|
||||
@@ -72,11 +72,11 @@ jobs:
|
||||
steps:
|
||||
- name: 🚚 Checkout ($${{ github.ref }})
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: 🚚 Checkout pull request (pull_request_target)
|
||||
if: github.event_name == 'pull_request_target'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
git log --oneline -n 10
|
||||
|
||||
- name: 📥 Cache library
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.PROJECT_PATH }}/Library
|
||||
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
${{ env.PROJECT_PATH }}-Library-
|
||||
|
||||
- name: 🛠️ Build Unity Project (Test)
|
||||
uses: game-ci/unity-builder@main
|
||||
uses: game-ci/unity-builder@v5
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"com.coffee.minimal-resource": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
|
||||
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||
"com.coffee.symbolic-linker": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
|
||||
"com.unity.ide.rider": "3.0.36",
|
||||
"com.unity.ide.rider": "3.0.38",
|
||||
"com.unity.test-framework": "1.1.33",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"com.unity.modules.animation": "1.0.0"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "3.0.36",
|
||||
"version": "3.0.38",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,3 +1,55 @@
|
||||
## [5.10.9](https://github.com/mob-sakai/UIEffect/compare/5.10.8...5.10.9) (2026-06-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ambiguous call to 'lerp' in shader ([cd68b36](https://github.com/mob-sakai/UIEffect/commit/cd68b364c48e979d6ef227e53a522f096e0df47a)), closes [#390](https://github.com/mob-sakai/UIEffect/issues/390)
|
||||
* Clarify that the `ShaderGraph support` is available only in Unity 2023.2/6.0 or later ([57031c3](https://github.com/mob-sakai/UIEffect/commit/57031c3e3c2d64ee76d3e568d378cd54a5e84af5)), closes [#391](https://github.com/mob-sakai/UIEffect/issues/391)
|
||||
* support Unity 6.5 or later ([2d6f7ed](https://github.com/mob-sakai/UIEffect/commit/2d6f7ed63dd83b3f90c2fa6d93a3c84afd6de866)), closes [#392](https://github.com/mob-sakai/UIEffect/issues/392) [#398](https://github.com/mob-sakai/UIEffect/issues/398)
|
||||
* UIEffect.detailColor is not working ([f3da972](https://github.com/mob-sakai/UIEffect/commit/f3da972c0cba526f7784207c2d8ab48b5dd692f3)), closes [#399](https://github.com/mob-sakai/UIEffect/issues/399)
|
||||
|
||||
## [5.10.8](https://github.com/mob-sakai/UIEffect/compare/5.10.7...5.10.8) (2026-01-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Canvas not properly cached when objects are outside Canvas ([4a4e50e](https://github.com/mob-sakai/UIEffect/commit/4a4e50e01fb50925352c73b27901024494ae933c))
|
||||
|
||||
## [5.10.7](https://github.com/mob-sakai/UIEffect/compare/5.10.6...5.10.7) (2025-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* support Unity 6000.4 ([7fc0c73](https://github.com/mob-sakai/UIEffect/commit/7fc0c7364d8dc39e26eac3c3b79797b139f09817))
|
||||
|
||||
## [5.10.6](https://github.com/mob-sakai/UIEffect/compare/5.10.5...5.10.6) (2025-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed an issue where shader variants were not registered automatically ([6b79864](https://github.com/mob-sakai/UIEffect/commit/6b79864a394d79e6ad13f64af1d521fab1f781a7)), closes [#383](https://github.com/mob-sakai/UIEffect/issues/383)
|
||||
|
||||
## [5.10.5](https://github.com/mob-sakai/UIEffect/compare/5.10.4...5.10.5) (2025-11-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* graphic disappears when changing filters from code ([8776057](https://github.com/mob-sakai/UIEffect/commit/87760570ec7f4e2ca395cfaa0d2ab5d28c9cf9f3)), closes [#382](https://github.com/mob-sakai/UIEffect/issues/382)
|
||||
|
||||
## [5.10.4](https://github.com/mob-sakai/UIEffect/compare/5.10.3...5.10.4) (2025-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove `sealed` from `UIEffect` and `UIEffectReplica` ([2fd87e9](https://github.com/mob-sakai/UIEffect/commit/2fd87e909af65bf88a9c39cd157dfb06a56b3af0)), closes [#379](https://github.com/mob-sakai/UIEffect/issues/379)
|
||||
|
||||
## [5.10.3](https://github.com/mob-sakai/UIEffect/compare/5.10.2...5.10.3) (2025-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* displays as black rectangle when opening editor ([4a8d341](https://github.com/mob-sakai/UIEffect/commit/4a8d341625f73d70c512f7e6f0b864be1adbf459)), closes [#376](https://github.com/mob-sakai/UIEffect/issues/376)
|
||||
|
||||
## [5.10.2](https://github.com/mob-sakai/UIEffect/compare/5.10.1...5.10.2) (2025-10-16)
|
||||
|
||||
|
||||
|
||||
@@ -514,6 +514,8 @@ Click the `Import` button.
|
||||
|
||||
### Usage with ShaderGraph
|
||||
|
||||
⚠️ ShaderGraph support is available only in Unity 2023.2/6.0 or later.
|
||||
|
||||

|
||||
|
||||
To use UIEffect with ShaderGraph, you need to import additional resources.
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Coffee.UIEffectInternal
|
||||
private static void GetComponentsInChildren_Internal<T>(this Component self, List<T> results, int depth)
|
||||
where T : Component
|
||||
{
|
||||
if (!self || results == null || depth < 0) return;
|
||||
if (self == null || results == null || depth < 0) return;
|
||||
|
||||
var tr = self.transform;
|
||||
if (tr.TryGetComponent<T>(out var t))
|
||||
@@ -59,7 +59,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
public static T GetOrAddComponent<T>(this Component self) where T : Component
|
||||
{
|
||||
if (!self) return null;
|
||||
if (self == null) return null;
|
||||
return self.TryGetComponent<T>(out var component)
|
||||
? component
|
||||
: self.gameObject.AddComponent<T>();
|
||||
@@ -166,7 +166,7 @@ namespace Coffee.UIEffectInternal
|
||||
#if !UNITY_2021_2_OR_NEWER && !UNITY_2020_3_45 && !UNITY_2020_3_46 && !UNITY_2020_3_47 && !UNITY_2020_3_48
|
||||
public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component
|
||||
{
|
||||
if (!self) return null;
|
||||
if (self == null) return null;
|
||||
if (!includeInactive) return self.GetComponentInParent<T>();
|
||||
|
||||
var current = self.transform;
|
||||
@@ -186,7 +186,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// </summary>
|
||||
internal static bool CanConvertTo<T>(this Object context) where T : MonoBehaviour
|
||||
{
|
||||
return context && context.GetType() != typeof(T);
|
||||
return context != null && context.GetType() != typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Coffee.UIEffectInternal
|
||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||
{
|
||||
var defaultSettings = GetDefaultSettings(t);
|
||||
if (!defaultSettings)
|
||||
if (defaultSettings == null)
|
||||
{
|
||||
// When create a new instance, automatically set it as default settings.
|
||||
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
|
||||
@@ -48,7 +48,7 @@ namespace Coffee.UIEffectInternal
|
||||
SetDefaultSettings(defaultSettings);
|
||||
}
|
||||
|
||||
if (defaultSettings)
|
||||
if (defaultSettings != null)
|
||||
{
|
||||
defaultSettings.OnInitialize();
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Coffee.UIEffectInternal
|
||||
private static Object[] GetPreloadedSettings(Type type)
|
||||
{
|
||||
return PlayerSettings.GetPreloadedAssets()
|
||||
.Where(x => x && x.GetType() == type)
|
||||
.Where(x => x != null && x.GetType() == type)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ namespace Coffee.UIEffectInternal
|
||||
?? AssetDatabase.FindAssets($"t:{nameof(PreloadedProjectSettings)}")
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.Select(AssetDatabase.LoadAssetAtPath<PreloadedProjectSettings>)
|
||||
.FirstOrDefault(x => x && x.GetType() == type);
|
||||
.FirstOrDefault(x => x != null && x.GetType() == type);
|
||||
}
|
||||
|
||||
protected static void SetDefaultSettings(PreloadedProjectSettings asset)
|
||||
{
|
||||
if (!asset) return;
|
||||
if (asset == null) return;
|
||||
|
||||
var type = asset.GetType();
|
||||
if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(asset)))
|
||||
@@ -103,7 +103,7 @@ namespace Coffee.UIEffectInternal
|
||||
var preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
||||
var projectSettings = GetPreloadedSettings(type);
|
||||
PlayerSettings.SetPreloadedAssets(preloadedAssets
|
||||
.Where(x => x)
|
||||
.Where(x => x != null)
|
||||
.Except(projectSettings.Except(new[] { asset }))
|
||||
.Append(asset)
|
||||
.Distinct()
|
||||
@@ -133,19 +133,19 @@ namespace Coffee.UIEffectInternal
|
||||
#if UNITY_EDITOR
|
||||
private string _jsonText;
|
||||
|
||||
public static bool hasInstance => s_Instance;
|
||||
public static bool hasInstance => s_Instance != null;
|
||||
|
||||
public static T instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_Instance) return s_Instance;
|
||||
if (s_Instance != null) return s_Instance;
|
||||
|
||||
s_Instance = GetDefaultSettings(typeof(T)) as T;
|
||||
if (s_Instance) return s_Instance;
|
||||
if (s_Instance != null) return s_Instance;
|
||||
|
||||
s_Instance = CreateInstance<T>();
|
||||
if (!s_Instance)
|
||||
if (s_Instance == null)
|
||||
{
|
||||
s_Instance = null;
|
||||
return s_Instance;
|
||||
@@ -176,7 +176,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static T instance => s_Instance ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -185,7 +185,7 @@ namespace Coffee.UIEffectInternal
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
var isDefaultSettings = !s_Instance || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
|
||||
var isDefaultSettings = s_Instance == null || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
|
||||
if (!isDefaultSettings)
|
||||
{
|
||||
DestroyImmediate(this, true);
|
||||
@@ -195,7 +195,7 @@ namespace Coffee.UIEffectInternal
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
#endif
|
||||
|
||||
if (s_Instance) return;
|
||||
if (s_Instance != null) return;
|
||||
s_Instance = this as T;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
if (!_target)
|
||||
if (_target == null)
|
||||
{
|
||||
if (_editor)
|
||||
{
|
||||
|
||||
+5
-5
@@ -11,7 +11,7 @@ using Conditional = System.Diagnostics.ConditionalAttribute;
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
{
|
||||
internal static class Logging
|
||||
internal static class Logger
|
||||
{
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
private const string k_DisableSymbol = "DISABLE_COFFEE_LOGGER";
|
||||
@@ -48,7 +48,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static void LogIf(bool enable, object tag, object message, Object context = null)
|
||||
{
|
||||
if (!enable) return;
|
||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
@@ -56,7 +56,7 @@ namespace Coffee.UIEffectInternal
|
||||
#endif
|
||||
public static void Log(object tag, object message, Object context = null)
|
||||
{
|
||||
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
#if !ENABLE_COFFEE_LOGGER
|
||||
@@ -64,13 +64,13 @@ namespace Coffee.UIEffectInternal
|
||||
#endif
|
||||
public static void LogWarning(object tag, object message, Object context = null)
|
||||
{
|
||||
Log_Internal(LogType.Warning, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Warning, tag, message, context != null ? context : tag as Object);
|
||||
}
|
||||
|
||||
public static void LogError(object tag, object message, Object context = null)
|
||||
{
|
||||
#if ENABLE_COFFEE_LOGGER
|
||||
Log_Internal(LogType.Error, tag, message, context ? context : tag as Object);
|
||||
Log_Internal(LogType.Error, tag, message, context != null ? context : tag as Object);
|
||||
#else
|
||||
Debug.LogError($"{tag}: {message}", context);
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2fa34e76bcd14489a1af18b393c3e65
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f0dee01a862040a58ac6b6057944cd3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -20,7 +20,9 @@ namespace Coffee.UIEffectInternal
|
||||
{
|
||||
public static T[] FindObjectsOfType<T>() where T : Object
|
||||
{
|
||||
#if UNITY_2023_1_OR_NEWER
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
return Object.FindObjectsByType<T>(FindObjectsInactive.Include);
|
||||
#elif UNITY_2023_1_OR_NEWER
|
||||
return Object.FindObjectsByType<T>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
#else
|
||||
return Object.FindObjectsOfType<T>();
|
||||
@@ -29,7 +31,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void Destroy(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
@@ -44,7 +46,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
public static void DestroyImmediate(Object obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
#if UNITY_EDITOR
|
||||
if (Application.isEditor)
|
||||
{
|
||||
@@ -61,7 +63,7 @@ namespace Coffee.UIEffectInternal
|
||||
public static void SetDirty(Object obj)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!obj) return;
|
||||
if (obj == null) return;
|
||||
EditorUtility.SetDirty(obj);
|
||||
#endif
|
||||
}
|
||||
@@ -117,11 +119,11 @@ namespace Coffee.UIEffectInternal
|
||||
foreach (var type in types)
|
||||
{
|
||||
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
|
||||
if (!script) continue;
|
||||
if (script == null) continue;
|
||||
|
||||
var path = type.GetCustomAttribute<IconAttribute>()?._path;
|
||||
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
|
||||
if (!icon) continue;
|
||||
if (icon == null) continue;
|
||||
|
||||
s_SetIconForObject(script, icon);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Coffee.UIEffectInternal
|
||||
/// <summary>
|
||||
/// Object pool.
|
||||
/// </summary>
|
||||
internal sealed class InternalObjectPool<T> where T : class
|
||||
internal class InternalObjectPool<T> where T : class
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
private readonly Predicate<T> _onValid; // Delegate for checking if instances are valid
|
||||
@@ -34,7 +34,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// If there are no instances in the pool, create a new one.
|
||||
Logging.Log(this, $"A new instance is created (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
Logger.Log(this, $"A new instance is created (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
return _pool.Get();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Coffee.UIEffectInternal
|
||||
if (instance == null) return; // Ignore if already pooled or null.
|
||||
|
||||
_pool.Release(instance);
|
||||
Logging.Log(this, $"An instance is released (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
Logger.Log(this, $"An instance is released (pooled: {_pool.CountInactive}, created: {_pool.CountAll}).");
|
||||
instance = default; // Set the reference to null.
|
||||
}
|
||||
#else
|
||||
@@ -80,7 +80,7 @@ namespace Coffee.UIEffectInternal
|
||||
}
|
||||
|
||||
// If there are no instances in the pool, create a new one.
|
||||
Logging.Log(this, $"A new instance is created (pooled: {_pool.Count}, created: {++_count}).");
|
||||
Logger.Log(this, $"A new instance is created (pooled: {_pool.Count}, created: {++_count}).");
|
||||
return _onCreate();
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
_onReturn(instance); // Return the instance to the pool.
|
||||
_pool.Push(instance);
|
||||
Logging.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
||||
Logger.Log(this, $"An instance is released (pooled: {_pool.Count}, created: {_count}).");
|
||||
instance = default; // Set the reference to null.
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Coffee.UIEffectInternal
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] GetFromCache");
|
||||
if (_cache.TryGetValue(hash, out var entry))
|
||||
{
|
||||
if (!entry.storedObject)
|
||||
if (entry.storedObject == null)
|
||||
{
|
||||
Release(ref entry.storedObject);
|
||||
Profiler.EndSample();
|
||||
@@ -103,7 +103,7 @@ namespace Coffee.UIEffectInternal
|
||||
Release(ref obj);
|
||||
++entry.reference;
|
||||
obj = entry.storedObject;
|
||||
Logging.Log(_name, $"Get(total#{count}): {entry}");
|
||||
Logger.Log(_name, $"Get(total#{count}): {entry}");
|
||||
}
|
||||
|
||||
Profiler.EndSample();
|
||||
@@ -116,7 +116,7 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
private void Add(Hash128 hash, ref T obj, T newObject)
|
||||
{
|
||||
if (!newObject)
|
||||
if (newObject == null)
|
||||
{
|
||||
Release(ref obj);
|
||||
obj = newObject;
|
||||
@@ -130,8 +130,8 @@ namespace Coffee.UIEffectInternal
|
||||
newEntry.hash = hash;
|
||||
newEntry.reference = 1;
|
||||
_cache[hash] = newEntry;
|
||||
_objectKey[newObject.GetInstanceID()] = hash;
|
||||
Logging.Log(_name, $"<color=#03c700>Add</color>(total#{count}): {newEntry}");
|
||||
_objectKey[newObject.GetHashCode()] = hash;
|
||||
Logger.Log(_name, $"<color=#03c700>Add</color>(total#{count}): {newEntry}");
|
||||
Release(ref obj);
|
||||
obj = newObject;
|
||||
Profiler.EndSample();
|
||||
@@ -146,23 +146,23 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
// Find and release the entry.
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Release");
|
||||
var id = obj.GetInstanceID();
|
||||
var id = obj.GetHashCode();
|
||||
if (_objectKey.TryGetValue(id, out var hash)
|
||||
&& _cache.TryGetValue(hash, out var entry))
|
||||
{
|
||||
entry.reference--;
|
||||
if (entry.reference <= 0 || !entry.storedObject)
|
||||
if (entry.reference <= 0 || entry.storedObject == null)
|
||||
{
|
||||
Remove(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Log(_name, $"Release(total#{_cache.Count}): {entry}");
|
||||
Logger.Log(_name, $"Release(total#{_cache.Count}): {entry}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Log(_name, $"Release(total#{_cache.Count}): <color=red>Already released: {obj}</color>");
|
||||
Logger.Log(_name, $"Release(total#{_cache.Count}): <color=red>Already released: {obj}</color>");
|
||||
}
|
||||
|
||||
obj = null;
|
||||
@@ -175,10 +175,10 @@ namespace Coffee.UIEffectInternal
|
||||
|
||||
Profiler.BeginSample("(COF)[ObjectRepository] Remove");
|
||||
_cache.Remove(entry.hash);
|
||||
_objectKey.Remove(entry.storedObject.GetInstanceID());
|
||||
_objectKey.Remove(entry.storedObject.GetHashCode());
|
||||
_pool.Push(entry);
|
||||
entry.reference = 0;
|
||||
Logging.Log(_name, $"<color=#f29e03>Remove</color>(total#{_cache.Count}): {entry}");
|
||||
Logger.Log(_name, $"<color=#f29e03>Remove</color>(total#{_cache.Count}): {entry}");
|
||||
entry.Release(_onRelease);
|
||||
Profiler.EndSample();
|
||||
}
|
||||
@@ -192,7 +192,7 @@ namespace Coffee.UIEffectInternal
|
||||
public void Release(Action<T> onRelease)
|
||||
{
|
||||
reference = 0;
|
||||
if (storedObject)
|
||||
if (storedObject != null)
|
||||
{
|
||||
onRelease?.Invoke(storedObject);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Coffee.UIEffectInternal
|
||||
if (!shader) return null;
|
||||
|
||||
// Already cached.
|
||||
var id = shader.GetInstanceID();
|
||||
var id = shader.GetHashCode();
|
||||
if (_cachedOptionalShaders.TryGetValue(id, out var optionalShaderName))
|
||||
{
|
||||
return Shader.Find(optionalShaderName);
|
||||
@@ -270,7 +270,7 @@ namespace Coffee.UIEffectInternal
|
||||
_sb.Length--; // Remove last space.
|
||||
}
|
||||
|
||||
var hash = new Hash128((uint)shader.GetInstanceID(), (uint)_sb.GetHashCode(), 0, 0);
|
||||
var hash = new Hash128((uint)shader.GetHashCode(), (uint)GetContentsHashCode(_sb), 0, 0);
|
||||
if (_cachedVariants.TryGetValue(hash, out var result))
|
||||
{
|
||||
Profiler.EndSample();
|
||||
@@ -288,6 +288,17 @@ namespace Coffee.UIEffectInternal
|
||||
Profiler.EndSample();
|
||||
return (variant, pair);
|
||||
}
|
||||
|
||||
private static int GetContentsHashCode(StringBuilder sb)
|
||||
{
|
||||
var hash = 17;
|
||||
for (var i = 0; i < sb.Length; i++)
|
||||
{
|
||||
hash = unchecked(hash * 31 + sb[i]);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Coffee.UIEffectInternal
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Coffee.UIEffectInternal
|
||||
static UIExtraCallbacks()
|
||||
{
|
||||
Canvas.willRenderCanvases += OnBeforeCanvasRebuild;
|
||||
Logging.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases", message: "ctor");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -78,7 +78,7 @@ namespace Coffee.UIEffectInternal
|
||||
#endif
|
||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||
Canvas.willRenderCanvases += OnAfterCanvasRebuild;
|
||||
Logging.LogMulticast(typeof(Canvas), "willRenderCanvases",
|
||||
Logger.LogMulticast(typeof(Canvas), "willRenderCanvases",
|
||||
message: "InitializeAfterCanvasRebuild");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Coffee.UIEffects
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
|
||||
[ExecuteAlways]
|
||||
[DisallowMultipleComponent]
|
||||
public sealed class UIEffect : UIEffectBase
|
||||
public class UIEffect : UIEffectBase
|
||||
{
|
||||
[SerializeField]
|
||||
protected ToneFilter m_ToneFilter = ToneFilter.None;
|
||||
@@ -282,6 +282,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ToneFilter == value) return;
|
||||
context.m_ToneFilter = m_ToneFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -311,6 +312,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_ColorFilter == value) return;
|
||||
context.m_ColorFilter = m_ColorFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -794,6 +796,7 @@ namespace Coffee.UIEffects
|
||||
(m_SrcBlendMode, m_DstBlendMode) = (m_BlendType, m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
context.m_SrcBlendMode = m_SrcBlendMode;
|
||||
context.m_DstBlendMode = m_DstBlendMode;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -810,6 +813,7 @@ namespace Coffee.UIEffects
|
||||
if (m_SrcBlendMode == value) return;
|
||||
context.m_SrcBlendMode = m_SrcBlendMode = value;
|
||||
m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -826,6 +830,7 @@ namespace Coffee.UIEffects
|
||||
if (m_DstBlendMode == value) return;
|
||||
context.m_DstBlendMode = m_DstBlendMode = value;
|
||||
m_BlendType = (m_SrcBlendMode, m_DstBlendMode).Convert();
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -838,6 +843,7 @@ namespace Coffee.UIEffects
|
||||
if (m_ShadowMode == value) return;
|
||||
context.m_ShadowMode = m_ShadowMode = value;
|
||||
SetVerticesDirty();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,6 +1019,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_EdgeMode == value) return;
|
||||
context.m_EdgeMode = m_EdgeMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1182,6 +1189,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_GradationMode == value) return;
|
||||
context.m_GradationMode = m_GradationMode = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1321,6 +1329,7 @@ namespace Coffee.UIEffects
|
||||
{
|
||||
if (m_DetailFilter == value) return;
|
||||
context.m_DetailFilter = m_DetailFilter = value;
|
||||
SetVerticesDirty();
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1350,11 +1359,11 @@ namespace Coffee.UIEffects
|
||||
|
||||
public Color detailColor
|
||||
{
|
||||
get => m_EdgeColor;
|
||||
get => m_DetailColor;
|
||||
set
|
||||
{
|
||||
if (m_EdgeColor == value) return;
|
||||
context.m_DetailColor = m_EdgeColor = value;
|
||||
if (m_DetailColor == value) return;
|
||||
context.m_DetailColor = m_DetailColor = value;
|
||||
SetMaterialDirty();
|
||||
}
|
||||
}
|
||||
@@ -1802,6 +1811,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
if (!append || src.m_DetailFilter != DetailFilter.None)
|
||||
{
|
||||
dst.m_DetailColor = src.m_DetailColor;
|
||||
dst.m_DetailFilter = src.m_DetailFilter;
|
||||
dst.m_DetailIntensity = src.m_DetailIntensity;
|
||||
dst.m_DetailThreshold = src.m_DetailThreshold;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Coffee.UIEffects
|
||||
|
||||
public Material effectMaterial => _material;
|
||||
public Graphic graphic => _graphic ? _graphic : _graphic = GetComponent<Graphic>();
|
||||
public virtual uint effectId => (uint)GetInstanceID();
|
||||
public virtual uint effectId => (uint)GetHashCode();
|
||||
public virtual float actualSamplingScale => 1;
|
||||
public virtual bool canModifyShape => true;
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace Coffee.UIEffects
|
||||
if (!_canvas || !_canvas.isActiveAndEnabled)
|
||||
{
|
||||
_canvas = null;
|
||||
_canvasCached = false;
|
||||
}
|
||||
|
||||
return _canvas;
|
||||
@@ -187,8 +188,8 @@ namespace Coffee.UIEffects
|
||||
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial");
|
||||
var samplingScaleId = (uint)(Mathf.InverseLerp(0.01f, 100, actualSamplingScale) * uint.MaxValue);
|
||||
var rootId = (uint)(transitionRoot ? transitionRoot.GetInstanceID() : 0);
|
||||
var hash = new Hash128((uint)baseMaterial.GetInstanceID(), effectId, samplingScaleId, rootId);
|
||||
var rootId = (uint)(transitionRoot ? transitionRoot.GetHashCode() : 0);
|
||||
var hash = new Hash128((uint)baseMaterial.GetHashCode(), effectId, samplingScaleId, rootId);
|
||||
if (!MaterialRepository.Valid(hash, _material))
|
||||
{
|
||||
Profiler.BeginSample("(UIE)[UIEffect] GetModifiedMaterial > Get or create material");
|
||||
|
||||
@@ -191,6 +191,15 @@ namespace Coffee.UIEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh all UI Graphics in the opened scenes. (#376)
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
foreach (var g in Misc.FindObjectsOfType<UnityEngine.UI.Graphic>())
|
||||
{
|
||||
g.SetAllDirty();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")]
|
||||
public sealed class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver
|
||||
public class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField] private UIEffect m_Target;
|
||||
[SerializeField] private UIEffectPreset m_Preset;
|
||||
@@ -102,8 +102,8 @@ namespace Coffee.UIEffects
|
||||
public override uint effectId => target
|
||||
? target.effectId
|
||||
: preset
|
||||
? (uint)preset.GetInstanceID()
|
||||
: (uint)GetInstanceID();
|
||||
? (uint)preset.GetHashCode()
|
||||
: (uint)GetHashCode();
|
||||
|
||||
|
||||
public override UIEffectContext context
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using System;
|
||||
using UnityEditor.Rendering.BuiltIn.ShaderGraph;
|
||||
using UnityEditor.ShaderGraph;
|
||||
#if UNITY_6000_4_OR_NEWER
|
||||
using GUID = UnityEngine.GUID;
|
||||
#else
|
||||
using GUID = UnityEditor.GUID;
|
||||
#endif
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGraph
|
||||
{
|
||||
|
||||
@@ -648,7 +648,7 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos)
|
||||
half sobel_v = v00 * -1.0 + v10 * -2.0 + v20 * -1.0 + v02 * 1.0 + v12 * 2.0 + v22 * 1.0;
|
||||
|
||||
const half sobel = sqrt(sobel_h * sobel_h + sobel_v * sobel_v) * _SamplingIntensity;
|
||||
return lerp(0, uieffect_internal(uv, uvMask, uvLocal, uvGrad, isShadow), inv_lerp(0.5, 1, sobel));
|
||||
return lerp(half4(0, 0, 0, 0), uieffect_internal(uv, uvMask, uvLocal, uvGrad, isShadow), inv_lerp(0.5, 1, sobel));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "com.coffee.ui-effect",
|
||||
"displayName": "UI Effect",
|
||||
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
|
||||
"version": "5.10.2",
|
||||
"version": "5.10.9",
|
||||
"unity": "2020.3",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"com.coffee.nano-monitor": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
|
||||
"com.coffee.symbolic-linker": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/SymbolicLinker",
|
||||
"com.coffee.ui-effect": "file:../../Packages/src",
|
||||
"com.unity.ide.rider": "3.0.35",
|
||||
"com.unity.ide.rider": "3.0.38",
|
||||
"com.unity.render-pipelines.universal": "17.0.4",
|
||||
"com.unity.test-framework": "1.5.1",
|
||||
"com.unity.timeline": "1.8.8",
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"dependencies": {}
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "3.0.35",
|
||||
"version": "3.0.38",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user