Giter Site home page Giter Site logo

coryleach / unitybindings Goto Github PK

View Code? Open in Web Editor NEW
38.0 2.0 3.0 206 KB

Utility components for quickly binding data values to views.

License: Apache License 2.0

C# 100.00%
unity bindings unity3d ui wire inotifypropertychanged binding reflection gui gameframe upm

unitybindings's Introduction

Gameframe.Bindings ๐Ÿ‘‹

Codacy Badge GitHub release (latest by date including pre-releases) openupm license

twitter

This is a library of binding components that allow you to quickly wire data sources to target properties via the inspector.

Binding changes propagate via the System.ComponentModel.INotifyPropertyChanged interface but the included binding components will also refresh their target properties in OnEnable.
A general purpose ComponentBinding monobehaviour is included to wire any two UnityEngine.Objects together as well as a TextBinding for quick and simple binding to text fields.

Quick Package Install

Using UnityPackageManager (for Unity 2019.3 or later)

Open the package manager window (menu: Window > Package Manager)
Select "Add package from git URL...", fill in the pop-up with the following link:
https://github.com/coryleach/UnityBindings.git#1.0.5

Using UnityPackageManager (for Unity 2019.1 or later)

Find the manifest.json file in the Packages folder of your project and edit it to look like this:

{
  "dependencies": {
    "com.gameframe.bindings": "https://github.com/coryleach/UnityBindings.git#1.0.5",
    ...
  },
}

Usage

This library contains a small set of components that can be used to bind source property values to target property values in the Unity inspector.
For an example of how the components are used import the package included in the Demo folder after installing this package.

Demo1 Demo2

//Bindings can also be created in code as follows
//Currently all bindings are one way from source to target
var binding = new Binding();

//If your source implements INotifyPropertyChanged correctly changes will automatically propagate
binding.SetSource(myData,"SourcePropertyName");
binding.SetTarget(myView,"TargetPropertyName");

//You can also force a refresh (unnecessary if source implements INotifyPropertyChange)
binding.Refresh();

//Temporarily disable bindings
binding.Enabled = false;

//Set a custom converter to transform source values before they are passed to the target
binding.Converter = (x) => x.ToString();

//Destroy the Binding
binding.Dispose(); 

Author

๐Ÿ‘ค Cory Leach

Show your support

Give a โญ๏ธ if this project helped you!


This README was generated with โค๏ธ by Gameframe.Packages

unitybindings's People

Contributors

coryleach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

unitybindings's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.