grofit / bindingsrx Goto Github PK
View Code? Open in Web Editor NEWA 2 way binding system for unity using unirx
License: MIT License
A 2 way binding system for unity using unirx
License: MIT License
var myReactiveProperty = new ReactiveProperty("hello");
var myInputField = GetComponent();
myInputField.BindTextTo(myReactiveProperty)
.AddTo(myReactiveProperty);
Is that the last myReactiveProperty fact myInputField?
GameObjectExtensions.BindChildPrefabsTo()
should destroy instantiated prefabs during element removal from ReactiveCollection.
But GameObjectExtensions.onElementRemoved()
destorys transform of instantiated prefab instead of gameobject.
This is not working if instance has RectTransfom.
There are 2 cases:
In both cases actual gameobject not destroyed.
I suggest replcaing impelmentation of GameObjectExtensions.onElementRemoved()
to:
void onElementRemoved(CollectionRemoveEvent<T> data)
{
var existingChild = input.transform.GetChild(data.Index).gameObject;
onChildRemoving?.Invoke(data.Value, existingChild);
GameObject.Destroy(existingChild);
}
Unity 5.4 has an issue within the mono compiler where it does not correctly find the right generic signatures within unirx.
There is specifically a build [here] (https://github.com/grofit/bindingsrx/releases/0.3.1) that explicitly sets the generics required, however in unity 5.5 and above this issue has been fixed.
If you wish to fix this issue yourself it is SUPER easy if you have resharper, as all you need to do is go to the problematic lines (unity will tell you where they are, generally all Select
statements) and just press alt + enter to infer generic usage, this will solve the problem for you.
If you do not use resharper or rider then all you need to do is go through GenericBindings.cs
and there will be a few .Select(Converter.From)
calls, and you just need to change these to .Select<T1,T2>(Converter.From)
(or depending on if its To/From in the call it may be T2
first then T1
), there are a few other issues unity will point out, but in most cases you can manually infer the generic and the problem will go away.
As mentioned the above build contains this fix, but new versions will only support unity 5.5 out the box, this is because the additional code changes are superfluous when the unity bug is fixed, also it is painful trying to keep 2 versions of unity installed and run with, so given the fixes are quite easy and there is a build to use to assist this should help those with u5.4 issues. Although if anyone wants to maintain it feel free to make a branch which is kept in-line with master but is for 5.4 releases or whatever.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.