To use this package, UniTask installation is required.
- Installing UniTaskPubSub allows for easier UI management, streamlining your workflow with an async/await-based messaging system.
- Installing QuickSave provides a simplified and efficient data saving system, making it easier to manage persistent data.
I’ve added classes and plugins to streamline development in Unity.
- Config
- Popup / Scene Base Classes
- Time Management
- UIBinding using UniTaskPubSub
- Singleton Pattern
- Logging
- User-Friendly UnityWebRequest Wrapper
- Infinity Value: Struct for infinite numbers with thousand-unit grouping
- Smart Addressables: Enhance the convenience and efficiency of using Unity's Addressables.
- Lite DB: Efficiently manages data using SQLite.
All data added to the ConfigManager
is saved in PlayerPrefs
.
ConfigManager.AddKey("Sound", 0);
ConfigManager.AddKey("BGM", 0);
ConfigManager.AddKey("DataKey", "DataValue");
var sound = ConfigManager.GetConfig("Sound");
ConfigManager.SetConfig("Sound", 100);
Editor Setup:
- Add a
PopupManager
to the Hierarchy. (It will run with DontDestroyOnLoad enabled.) - Cache your
popups
in the Popups field of thePopupManager
.
public class SettingPopup : Popup
{
// ...
}
public class CommonPopup : Popup
{
// ...
}
public class SettingData
{
public int Volume;
// ...
}
// Calling GetPopup will also trigger the popup's Open method.
var commonPopup = PopupManager.GetPopup<CommonPopup>();
// objName : Txt_Level, TMP Support
var lvTxt = commonPopup.Get<Text>("Level");
var lvTxt = commonPopup.Get<TMP_Text>("Level");
SettingData data = new SettingData { Volume = 200 };
var settingPopup = PopupManager.GetPopup<SettingPopup>(data);
TimeManager
only returns the current time.
DateTime now = TimeManager.Now;
TimeManager.TimeScale = 2;
We used the hadashiA/UniTaskPubSub repository. For more details, check out the link.
This setup simplifies event management.
// Register
UIBindingManager.Subscribe<SettingData>(data =>
{
SetVolume(data.Volume);
});
// Call
UIBindingManager.Publish(new SettingData { Volume = 5 });
Access and use each singleton via Class.Instance
, just like any other singleton pattern.
- MonoSingleton: A singleton that inherits from MonoBehaviour.
- PersistentMonoSingleton: Like MonoSingleton but uses
DontDestroyOnLoad
to persist between scenes. - Singleton: An object used as a singleton without MonoBehaviour.
The package includes a basic Log
class.
If you need customization, you can implement a custom logger by inheriting from IGameLog
.
For reference, see GameLog.cs
in the package.
GameLog.Debug("Debug");
GameLog.Info("Info");
GameLog.Warning("Warning");
GameLog.Error("Error");
throw GameLog.Fatal("Fatal");
This class is designed to wrap UnityWebRequest for a cleaner and more user-friendly experience.
var result = new HttpLink.Builder()
.SetUrl("https://jsonplaceholder.typicode.com/posts/1")
.SetMethod("GET")
.Build();
await result.SendAsync();
if (result.Success)
{
var resultBytes = result.ReceiveData;
var resultStr = result.ReceiveDataString;
}