{"id":13662473,"url":"https://github.com/UnioGame/UniGame.ViewSystem","last_synced_at":"2025-04-25T10:31:47.762Z","repository":{"id":40889186,"uuid":"246238552","full_name":"UnioGame/UniGame.ViewSystem","owner":"UnioGame","description":"MVVM Views System for Unity3D","archived":false,"fork":false,"pushed_at":"2025-03-09T10:56:26.000Z","size":18848,"stargazers_count":109,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T07:22:40.850Z","etag":null,"topics":["mvvm","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UnioGame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-10T07:48:18.000Z","updated_at":"2025-03-23T13:04:33.000Z","dependencies_parsed_at":"2023-12-13T20:05:02.069Z","dependency_job_id":"6d695689-cc89-4f4f-b9e7-a1d12260e52d","html_url":"https://github.com/UnioGame/UniGame.ViewSystem","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnioGame%2FUniGame.ViewSystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnioGame%2FUniGame.ViewSystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnioGame%2FUniGame.ViewSystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnioGame%2FUniGame.ViewSystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UnioGame","download_url":"https://codeload.github.com/UnioGame/UniGame.ViewSystem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250798243,"owners_count":21489047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mvvm","unity","unity3d"],"created_at":"2024-08-02T05:01:59.596Z","updated_at":"2025-04-25T10:31:47.747Z","avatar_url":"https://github.com/UnioGame.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# UniGame.ViewSystem\n\nMVVM View System for Unity3D\n\n**Odin Inspector Asset recommended to usage with this Package (https://odininspector.com)**\n\n\n- [UniGame.ViewSystem](#unigameviewsystem)\n  - [Overview](#overview)\n  - [Getting Started](#getting-started)\n  - [Getting Started](#getting-started-1)\n  - [View System Settings](#view-system-settings)\n    - [Create Settings](#create-settings)\n    - [SetUp Views Locations](#setup-views-locations)\n    - [Addressable Support](#addressable-support)\n    - [Nested View Sources](#nested-view-sources)\n    - [Layouts Control](#layouts-control)\n    - [Settings Rebuild](#settings-rebuild)\n  - [Skins Support](#skins-support)\n    - [Skins via folders](#skins-via-folders)\n    - [Skins via component](#skins-via-component)\n    - [Custom Views Factory](#custom-views-factory)\n  - [Pooling Support](#pooling-support)\n  - [API References](#api-references)\n    - [Views \\\u0026 ViewModels](#views--viewmodels)\n    - [Reactive Binding](#reactive-binding)\n      - [Bind To UGUI](#bind-to-ugui)\n      - [Behaviour bindings](#behaviour-bindings)\n  - [Examples](#examples)\n    - [Item List View](#item-list-view)\n    - [Localization View](#localization-view)\n    - [Nested Views Sources](#nested-views-sources)\n    - [View Skin loading](#view-skin-loading)\n    - [Real Project Demo](#real-project-demo)\n  - [License](#license)\n\n## Overview\n\n- support base principles of MVVM concepts.\n- support ui skins out of the box\n- based on Unity Addressables Resources\n- handle Addressables Resource lifetime\n\n## Getting Started\n\nAdd to your project manifiest by path [%UnityProject%]/Packages/manifiest.json new Scope:\n\n```json\n{\n  \"dependencies\": {\n    \"com.unigame.viewsystem\" : \"https://github.com/UnioGame/UniGame.ViewSystem.git\"\n    \"com.unigame.localization\": \"https://github.com/UnioGame/UniGame.Localization.git\",\n    \"com.unigame.coremodules\": \"https://github.com/UnioGame/UniGame.CoreModules.git\",\n    \"com.cysharp.unitask\" : \"https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask\"\n  }\n}\n```\n\nand now install via Package Manager\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Readme/Assets/package_manager.png)\n\n## Getting Started\n\n- Create View System Asset\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/view_asset_prefab.png)\n\n\n## View System Settings\n\n### Create Settings\n\n![](https://i.gyazo.com/15833fe0019b9570d68cab6ba20d3df6.png)\n\n\n### SetUp Views Locations\n\nHere you can initialize locations of views\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/views_setup.png)\n\nFor skinned views. Skin name of view equal to it's parent folder. Your project views prefabs structure involve direct mapping into its skins \n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/skin-folders-names.png)\n\n\n### Addressable Support\n\nFor now All views load at runtime through  \u003ca href=\"https://docs.unity3d.com/Packages/com.unity.addressables@latest\"\u003eUnity Addressable Asset system\u003c/a\u003e\n\nBy default if your views not registered as Addressable Asset when View System automatically register it into new Addressable Group With name equal to its ViewsSettings Source Name\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/view-settings-source-name1.png)\n\nYou can enable Addressable Group Name override:\n\n- Enable \"Apply Addressable Group\" option\n- SetUp new views group name\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/views-addressable-override.png)\n\n### Nested View Sources\n\nView System Support additional \"nested\" view settings sources. All view from that sources will be registered into main View System when it loaded. All nested view settings loads async. If that't source must be loaded before the View System will be available its possible activate \"Await Loading\" option.\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/nested-settings-await.png)\n\n### Layouts Control\n\n\"Layout Flow Control\" asset control views behaviours between all layouts. View System support two flow behaviour out from the box.\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/views-flow-control.png)\n\n- DefaultFlow \n\nBase flow controller with auto closing screens/windows when active scene changed\n\n- SingleViewFlow\n\nMore complex flow with support 'IScreenSuspendingWindow' api. If View with 'IScreenSuspendingWindow' is open, when all current screens wills suspend and resume after it closed.\n\n### Settings Rebuild\n\n\nYou can manualy trigger rebuild:\n\n- Rebuild Command\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/view-settings-rebuild.png)\n\n- For All Settings\n\n![](https://i.gyazo.com/df803c28a8a9feb702cda99734cb9288.png)\n\n- For target settings asset from inspector context menu\n\n![](https://i.gyazo.com/7df8670d31e77df4c8f69bc2e7da9d92.png)\n\n\n## Skins Support\nDifferent flavours of the same view type can be created by utilizing skins. When a skin tag is provided on view creation the corresponding skin is instantiated (if it's been registered prior to it). Skin tag can be provided as a string or a variable of SkinId type (which allows choosing one of the registered tags from a dropdown list and implicitly converts it to a string)\n```cs\nvoid ExampleFunc(SkinId largeDemoView) {\n  await gameViewSystem.OpenWindow\u003cDemoView\u003e(ViewModel, \"SmallDemoView\");\n  await gameViewSystem.OpenWindow\u003cDemoView\u003e(ViewModel, largeDemoView);\n}\n```\n### Skins via folders\nPlace views of the same type in separate folders and add them to the UI Views Skin Folders list in view system settings. After rebuilding the views will be added to the views registry with folder names as their skin tags\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/skin-folders-names.png)\n\n### Skins via component\nAdd View Skin Component to a prefab to turn it into a skin. To add a new skin tag enter it into Skin Tag Name field and press Invoke, an existing tag can be chosen from the Skin Tag dropdown list. No need to specify skin folders in view system settings\n![image](https://user-images.githubusercontent.com/72013166/126639139-974d1458-7c14-490d-8b6a-4f3c1de33fa5.png)\n![image](https://user-images.githubusercontent.com/72013166/126639300-bcc028a7-5070-4e78-9495-6d76c0ffc3b1.png)\n\n\n### Custom Views Factory\n\nView Factory - provide custom view creation logic. You can create your own factory by implementing:\n\n - **IViewFactory** \n - **IViewFactoryProvider**\n\nAnd select new provider in View System Settings\n\n#### Enable Zenject DI Support\n\nAdd to your project scriptings define symbol \"ZENJECT_ENABLED\" to enable Zenject DI support\n\n![image](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/viewfactoriessettings.png)\n\nAnywhere in your initialization of game pass Zenject DiContainer to ZenjectViewFactoryProvider.Container static field\n\n```csharp\npublic class ZenjectViewFactoryProvider : IViewFactoryProvider\n{\n    public static DiContainer Container { get; set; }\n}\n```\n\nYou can use Zenject DI module as an example to create your own custom DI support in view lines of code. Module is located in ZenjectViewModule directory\n\n```csharp\n\n//ZenjectViewFactory example\npublic class ZenjectViewFactory  : IViewFactory\n{\n    public ViewFactory _viewFactory;\n    public DiContainer _container;\n    \n    public ZenjectViewFactory(DiContainer container,AsyncLazy readyStatus, IViewResourceProvider viewResourceProvider)\n    {\n        _container = container;\n        _viewFactory = new ViewFactory(readyStatus, viewResourceProvider);\n    }\n    \n    public async UniTask\u003cIView\u003e Create(string viewId, \n        string skinTag = \"\", \n        Transform parent = null, \n        string viewName = null,\n        bool stayWorldPosition = false)\n    {\n        var view = await _viewFactory.Create(viewId, skinTag, parent, viewName, stayWorldPosition);\n        if (view == null || view.GameObject == null) return view;\n        var viewObject = view.GameObject;\n        \n        _container.InjectGameObject(viewObject);\n        return view;\n    }\n}\n\n```\n\n## Pooling Support\n\n## API References\n\n### Views \u0026 ViewModels\n\n### Reactive Binding\n\nAll base Bind extensions use ViewModelLifetime\" thats allow auto disconnect from data streams when ViewModel changed\n\nBinding extensions allow you easy connect you view and data sources with rich set flow syntax and support Rx method and async/await semantics\n\n#### Bind To UGUI \n\nHelp methods to direct bind unity UGUI types to data streams\n\n- Button methods\n\nBind Button to model action\n\n```cs\n\npublic Button openChest;\n\n[Serializable]\npublic class WindowViewModel : ViewModelBase\n{\n    public ReactiveCommand checkAction = new ReactiveCommand();\n    public IReactiveCommand\u003cUnit\u003e ChestAction =\u003e checkAction;\n}\n\nprotected override UniTask OnViewInitialize(WindowViewModel model)\n{\n    this.Bind(openChest,model.ChestAction);\n    \n    return UniTask.CompletedTask;\n}\n\n```\n\nBind Model to Button invoke\n\n\n```cs\n\npublic Button openChest;\n\n[Serializable]\npublic class WindowViewModel : ViewModelBase\n{\n    public ReactiveCommand checkAction = new ReactiveCommand();\n    public IReactiveCommand\u003cUnit\u003e ChestAction =\u003e checkAction;\n}\n\nprotected override UniTask OnViewInitialize(WindowViewModel model)\n{\n    this.Bind(model.ChestAction,openChest);\n    \n    return UniTask.CompletedTask;\n}\n\n```\n\n- TextMeshPro methods\n\n```cs\n\n[Serializable]\npublic class WindowViewModel : ViewModelBase\n{\n    public ReactiveProperty\u003cstring\u003e label = new ReactiveProperty\u003cstring\u003e();\n    public ReactiveProperty\u003cstring\u003e value = new ReactiveProperty\u003cstring\u003e();\n    \n    public IObservable\u003cstring\u003e Label =\u003e label;\n    public IObservable\u003cstring\u003e Value =\u003e value;\n}\n\npublic TextMeshProUGUI label;\npublic TextMeshProUGUI value;\n\nprotected override UniTask OnViewInitialize(WindowViewModel model)\n{\n    this.Bind(model.Label,label)\n        .Bind(model.Value,value);\n    \n    return UniTask.CompletedTask;\n}\n\n```\n\n- Image methods\n\n- LocaliztionString methods\n\n#### Behaviour bindings\n\nAllow you call show/hide/close and another actions with when views/data streams events occurs\n\n## Examples\n\nAll examples can be found here:\n\nhttps://github.com/UniGameTeam/UniGame.ViewSystem.Examples\n\n### Item List View\n\n![](https://github.com/UniGameTeam/UniGame.UISystem/blob/master/Readme/Assets/ui_list_demo.gif)\n\n### Localization View\n\n![](https://github.com/UniGameTeam/UniGame.UISystem/blob/master/Readme/Assets/localization_example.gif)\n\n### Nested Views Sources\n\n![](https://github.com/UniGameTeam/UniGame.UISystem/blob/master/Readme/Assets/nested_sources.png)\n\n### View Skin loading\n\n![](https://github.com/UniGameTeam/UniGame.UISystem/blob/master/Readme/Assets/skins_views.gif)\n\n### Real Project Demo\n\n![](https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/Editor/GitAssets/game-hud.gif)\n\n## License\n\n\u003ca href=\"https://github.com/UniGameTeam/UniGame.ViewSystem/blob/master/LICENSE\"\u003eMIT\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnioGame%2FUniGame.ViewSystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUnioGame%2FUniGame.ViewSystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnioGame%2FUniGame.ViewSystem/lists"}