From 94068e078b56e45fb38476cbc57598e95462cdf6 Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 17 Sep 2024 16:26:07 +0700 Subject: [PATCH 1/3] - fix: log error when audio clip null --- VirtueSky/Audio/Runtime/SoundComponent.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VirtueSky/Audio/Runtime/SoundComponent.cs b/VirtueSky/Audio/Runtime/SoundComponent.cs index 97dc6ec7..73cc9f4f 100644 --- a/VirtueSky/Audio/Runtime/SoundComponent.cs +++ b/VirtueSky/Audio/Runtime/SoundComponent.cs @@ -33,6 +33,12 @@ private void Awake() internal void PlayAudioClip(AudioClip audioClip, bool isLooping, float volume) { + if (audioClip == null) + { + Debug.LogError($"AudioClip is null"); + return; + } + component.clip = audioClip; component.loop = isLooping; component.volume = volume; From d346b2be80606d5569424d54cac2707eb2b87bdc Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 17 Sep 2024 16:59:48 +0700 Subject: [PATCH 2/3] - custom highlight editor for scriptable event and variable --- VirtueSky/Core/BaseSO.cs | 3 ++- VirtueSky/Events/Runtime/Base_Event/BaseEvent.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/VirtueSky/Core/BaseSO.cs b/VirtueSky/Core/BaseSO.cs index 734e5523..cd2368ce 100644 --- a/VirtueSky/Core/BaseSO.cs +++ b/VirtueSky/Core/BaseSO.cs @@ -1,11 +1,12 @@ using UnityEngine; +using VirtueSky.Inspector; namespace VirtueSky.Core { public class BaseSO : ScriptableObject, IEntity { - [Space(10)] [SerializeField] [TextArea(2, 5)] + [GUIColor(0.8f, 1.0f, 0.6f), Space(10), SerializeField, TextArea(2, 5)] private string description; public void Enable() diff --git a/VirtueSky/Events/Runtime/Base_Event/BaseEvent.cs b/VirtueSky/Events/Runtime/Base_Event/BaseEvent.cs index 5ebb37a1..a688d479 100644 --- a/VirtueSky/Events/Runtime/Base_Event/BaseEvent.cs +++ b/VirtueSky/Events/Runtime/Base_Event/BaseEvent.cs @@ -16,7 +16,7 @@ public class BaseEvent : BaseSO, IEvent #if UNITY_EDITOR [ShowIf(nameof(ConditionShow))] - [Button("Raise")] + [GUIColor(0.6f, 0.9f, 1.0f), Button("Raise")] private void DebugRaiseEvent() { Raise(); @@ -82,11 +82,11 @@ public class BaseEvent : BaseSO, IEvent readonly List> listeners = new List>(); private Action onRaised = null; #if UNITY_EDITOR - [Space(10)] [ShowIf(nameof(ConditionShow))] [SerializeField] + [Space(10)] [ShowIf(nameof(ConditionShow))] [GUIColor(0.6f, 0.9f, 1.0f), SerializeField] private TType valueDebug = default(TType); [ShowIf(nameof(ConditionShow))] - [Button("Raise")] + [GUIColor(0.6f, 0.9f, 1.0f), Button("Raise")] private void DebugRaiseEvent() { Raise(valueDebug); @@ -153,14 +153,14 @@ public class BaseEvent : BaseSO, IEvent private Func onRaised = null; #if UNITY_EDITOR - [Space(10)] [ShowIf(nameof(ConditionShow))] [SerializeField] + [Space(10)] [ShowIf(nameof(ConditionShow))] [GUIColor(0.6f, 0.9f, 1.0f), SerializeField] private TType valueDebug = default(TType); - [ShowIf(nameof(ConditionShow))] [ReadOnly, SerializeField] + [ShowIf(nameof(ConditionShow))] [GUIColor(0.6f, 0.9f, 1.0f), ReadOnly, SerializeField] private TResult valueResult = default(TResult); [ShowIf(nameof(ConditionShow))] - [Button("Raise")] + [GUIColor(0.6f, 0.9f, 1.0f), Button("Raise")] private void DebugRaiseEvent() { valueResult = Raise(valueDebug); From b9e31593f3689010b99e69da14d24321b113fd3f Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 17 Sep 2024 17:06:41 +0700 Subject: [PATCH 3/3] - update version --- README.md | 4 ++-- VirtueSky/ControlPanel/ConstantPackage.cs | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index df9d9141..4739cbfb 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ ### 1: Download the repo and drop it into folder `Assets` ### 2: Add the line below to `Packages/manifest.json` -for version `3.0.3` +for version `3.0.4` ```csharp -"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.0.3", +"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.0.4", ``` ## Includes modules diff --git a/VirtueSky/ControlPanel/ConstantPackage.cs b/VirtueSky/ControlPanel/ConstantPackage.cs index 4be8329b..bdd76e93 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -2,7 +2,7 @@ { public class ConstantPackage { - public const string VersionSunflower = "3.0.3"; + public const string VersionSunflower = "3.0.4"; public const string PackageNameInAppPurchase = "com.unity.purchasing"; public const string MaxVersionInAppPurchase = "4.12.2"; public const string PackageNameNewtonsoftJson = "com.unity.nuget.newtonsoft-json"; diff --git a/package.json b/package.json index 6259ccc3..a145608a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.virtuesky.sunflower", "displayName": "Sunflower", "description": "Core ScriptableObject Architecture for building Unity games", - "version": "3.0.3", + "version": "3.0.4", "unity": "2022.3", "category": "virtuesky", "license": "MIT",