k.Ui
manage your UI (open, close from code easily)
hard_drive
0 MB
folder
40 files
build
Engine v17
history
Last update 460d ago
About This Package
Manage your screens a bit easier.
Start
- Create UI config | Asset Browser | Right click -> k.UI -> UiConfig
- Create prefab for each view, add Screen Panel, Razor component and class that inherits from ViewBase
- Register your prefabs in the config
- Add UiInitializer on your initialization scene and pick your UiConfig
Make a View
- Create script derived from ViewBase
public class ExampleView : ViewBase
{
}- Attach script to your UI window prefab
- Reference prefab in UiConfig
Open a View
Ui.Open<ExampleView>();
Close a View
Ui.Close<ExampleView>();
How to pass a custom data model
- Create a model
public class PlayerViewModel : ViewModelBase
{
public string Name { get; set; }
public int Health { get; set; }
// we will add constructor for ease of use
public PlayerViewModel( string name, int health )
{
Name = name;
Health = health;
}
}
- Override OnViewModelUpdate method in your target ViewBase class
- Cast (!) your data model and process your data
public class PlayerInfoView : ViewBase
{
[Property] public PlayerHUD PlayerHUD { get; set; }
public override void OnViewModelUpdate( ViewModelBase model )
{
base.OnViewModelUpdate( model );
if ( model is PlayerViewModel playerViewModel )
{
PlayerHUD.SetPlayerViewModel( playerViewModel );
}
}
}- Now you can open your UI with a data model
Ui.Open<PlayerInfoView>( new PlayerViewModel( "k0fe", 100 ) );
Be aware, that OnViewModelUpdate is better to be avoid when we want to update UI often. Instead we should use BuildHash in Blazor or anything else. OnViewModelUpdate is better used when we want to inject specific classes in our ViewBase classes.
No usage statistics available
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
Package ID:
kfe.kui
Created:
2025-04-01 08:05 UTC
Updated:
2025-04-06 01:29 UTC
Type:
library
Public:
Yes
Version:
95226
files:
40
Size:
0.0 MB
Engine Version:
17
Asset Version ID:
95226
Version Created:
2025-04-06 01:29 UTC
Hash:
-7486759074735172923
Manifest: Open manifest
Resources:
Code Package References:
95226
Apr 6, 2025
Changes on 2025-04-06
94473
Apr 1, 2025
Changes on 2025-04-01



