Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

MVVM and Databinding for Unity3d

Discussion in 'Assets and Asset Store' started by LoxodonStudio, Aug 15, 2018.

  1. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41

    Unity MVVM Framework


    LoxodonFramework is a lightweight MVVM(Model-View-ViewModel) framework built specifically to target Unity3D. Databinding and localization are supported.It has a very flexible extensibility.It makes your game development faster and easier.

    For tutorials,examples and support,please see the project.You can also discuss the project in the Unity Forums.

    The plugin is compatible with MacOSX,Windows,Linux,UWP,IOS and Android,and provides all the source code of the project.

    Check out the source code from github

    Tested in Unity 3D on the following platforms:
    • PC/Mac/Linux
    • Android
    • IOS
    • UWP(Windows 10)
    • WebGL

    Key features:
    • MVVM Framework;
    • Multiple platforms;
    • Higher Extensibility;
    • async&await (C#&Lua)
    • try&catch&finally for lua
    • XLua support(You can make your game in lua.);
    • Asynchronous result and asynchronous task are supported;
    • Scheduled Executor and Multi-threading;
    • Messaging system support;
    • Preferences can be encrypted;
    • Localization support;
    • Databinding support:
      • Field binding;
      • Property binding;
      • Dictionary,list and array binding;
      • Event binding;
      • Unity3d's EventBase binding;
      • Static property and field binding;
      • Method binding;
      • Command binding;
      • ObservableProperty,ObservableDictionary and ObservableList binding;
      • Expression binding;

    Plugins:
    • Loxodon Framework OSA
    • Loxodon Framework Data
    • Loxodon Framework Fody
    • Loxodon Framework UIToolkit
    • Loxodon Framework ILRuntime
    • Loxodon Framework Localization For CSV

      It supports localization files in csv format, requires Unity2018.4 or higher.
    • Loxodon Framework XLua

      It supports making games with lua scripts.
    • Loxodon Framework Bundle

      Loxodon Framework Bundle is an AssetBundle manager.It provides a functionality that can automatically manage/load an AssetBundle and its dependencies from local or remote location.Asset Dependency Management including BundleManifest that keep track of every AssetBundle and all of their dependencies. An AssetBundle Simulation Mode which allows for iterative testing of AssetBundles in a the Unity editor without ever building an AssetBundle.

      The asset redundancy analyzer can help you find the redundant assets included in the AssetsBundles.Create a fingerprint for the asset by collecting the characteristic data of the asset. Find out the redundant assets in all AssetBundles by fingerprint comparison.it only supports the AssetBundle of Unity 5.6 or higher.
    • Loxodon Framework Log4Net

      This is a log plugin.It helps you to use Log4Net in the Unity3d.
    • Loxodon Framework Connection

      This is a network connection component, implemented using TcpClient, supports IPV6 and IPV4, automatically recognizes the current network when connecting with a domain name, and preferentially connects to the IPV4 network.
    • DotNetty for Unity

      DotNetty is a port of Netty, asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

      This version is modified based on DotNetty's 0.7.2 version and is a customized version for the Unity development platform. It removes some dependent libraries and passes the test under IL2CPP.

    For More Information Contact Us at: yangpc.china@gmail.com
     
    Last edited: Jan 9, 2023
    Zitga likes this.
  2. Zitga

    Zitga

    Joined:
    Mar 21, 2016
    Posts:
    3
    Thank you Loxedon. I read your project, it's so great.
    I wonder you can list some game used xlua unity? Thanks
     
  3. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Hi,Zitga
    This is a project that has been going on for more than 3 years. It is very stable and has few bugs.Its performance has been optimized several times and used in our team's MMO game project.There are also some other teams that use it, but I haven't paid attention to what their products are.
     
  4. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,058
    @vovgou I'm only interested in the data binding part. Specifically the "BindingSet" class that I see that it's where all the magic happens. But I see that it's coupled to many other components and classes so it's not easy to take only the code I want.

    I only want the pure binding part and nothing more.

    I'm thinking on using it with Prism.Core package now that we can use .NET Standard 2.0 packages:

    https://www.nuget.org/packages/Prism.Core/

    That I'm used to in WPF projects.

    How this sounds to you?

    Another question. I see that WebGL is not listed as a platform, it's not compatible with it (data binding code)?
     
  5. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Hi,@N3uRo

    The BindingSet is highly coupled with the framework. If you want to port it to the Prism framework, you need to do a lot of work. You can refer to my code to implement a similar feature for Prism.Core.

    I don't know much about Primse, I don't know if it works in Unity3d.As far as I know, the data binding features of many MVVM frameworks are based on reflection, and the efficiency of the mobile platform is not very good.

    Loxodon Framework was developed specifically for Unity3D, which uses delegates instead of reflections in platforms that support JIT, and optimizes GC as much as possible.On platforms that do not support JIT, you can also get better performance by statically injecting property accessors.

    My framework should be able to run on the WebGL platform, except for the multi-threaded part,But i have not tested it.
     
  6. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    240
    https://github.com/cocowolf/loxodon-framework/issues/4
    Hi, I own your bundle product on unity asset store. I am trying to find out more info about AOT Trampolines on iOS. I found this link below:
    https://www.mono-project.com/docs/advanced/runtime/docs/trampolines/

    • however I do not know the specifics of how it relates to your project or how to use this feature. Where do I paste your AOT Compilation Option?
      xcode? xamarin?
    Can I paste only one option or all?
    i.e. are they referring to standard, PLT, delegate?

    I believe I understand what they do. It is the only way to use runtime code on iOS - as the iOS platform doesn't support JIT. I assume this lets us use xlua on iOS. My limited understanding is that on AOT we get a token for the type/ptl/delegate we are accessing so we can call the method from xlua in a more static and likely secure way?

    Mainly just a hello world for iOS and AOT using these trampolines and where to put those compilation options and what each does, is all we would need.

    Thank you for your time reading this.
     
  7. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Hi

    The configuration of trampolines is not necessary now, but in the early versions of Unity3d, if not configured, it will cause a crash on the IOS platform.

    Please read the following article:
    https://forum.unity.com/threads/trampolines-which-is-for-what.342739/

    Please configure them in the location shown below.

    upload_2019-8-13_9-48-19.png
     
    CommunityUS likes this.
  8. viktorkadza

    viktorkadza

    Joined:
    Sep 4, 2018
    Posts:
    46
    Hi, is it a way to make Two Way collection binding ? I tried just add a twoway() when binded a collection item with a property method but it seams doesn work.
     
  9. TomavX

    TomavX

    Joined:
    Oct 23, 2016
    Posts:
    4
    Hi, in the documentation it says: supports C# event binding. How is this possible? I can use Unity events, but cannot find a way to bind C# events. I do it the old way:

    Code (CSharp):
    1. protected override void OnEnable()
    2. {
    3.     base.OnEnable();
    4.         if(_viewModel is null) return;
    5.         myTextField.OnTextChanged += _viewModel.OnMyTextChanged;
    6. }
    7. protected override void OnDisable()
    8. {
    9.     base.OnDisable();
    10.     if(_viewModel is null) return;
    11.         myTextField.OnTextChanged -= _viewModel.OnMyTextChanged;
    12. }
    And thanks for that great work.
     
    Last edited: Jan 29, 2024
  10. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Please see the documentation and examples in my framework.

    upload_2024-1-30_12-50-33.png

    upload_2024-1-30_12-50-0.png