Comments (3)
Yes, it uses reflection. To reduce it, propertyinfos are cached on awake for DataContext and INPCBinding, and there is some additional processing relegated to editor build-time for the CommandBinding. Most of the real cost comes from the use of GetValue and SetValue when properties are changed.
Again, though, this is only when the properties are changed, which also only happens if the classes with those properties implement INotifyPropertyChanged. If they don't, then the properties are only gotten once. SetValue happens whenever the interface changes need to be applied back to the viewmodel.
While slow compared to direct access, it is plenty fast(1200 nano seconds for a getvalue) for a standard user interface, as people are slow when it comes to typing, clicking buttons, etc - things that happen less than once per frame. Do not use it to do something like binding to an object's position that is updated every frame.
You can also see for yourself by running one of the example scenes that the framerate is basically unaffected by the use of the inpcbinding components.
As a last remark: Unity themselves use reflection for the UnityEvents, in the form of invoking delegates.
from ugui-mvvm.
commit e63bd8d now also addresses this via giving you the option of generating property accessor functions.
from ugui-mvvm.
cool
from ugui-mvvm.
Related Issues (15)
- Getting errors in the example scene HOT 3
- Auto-suggestions of types does not work well with long namespaces HOT 1
- A CommandBinding directly against a DataContext (i.e. 'this', not a sub property) complains in Editor only about an invalid property
- DataContext suggestions show compiler generated classes in the dropdown HOT 5
- DataContext suggestions contain too many items in a large project
- Is it possible to bind multiple data to a component? HOT 1
- Can't build for UWP HOT 2
- In Editor, when bound to an interface (or other late-provided source) mock data should be auto generated (and editable)
- Command Binding Editor should surface a way to jump to the command's code
- Values produced by bindings (through converters) need a cleanup path
- PropertyBinding issue
- Consider renaming INPCBinding to PropertyBinding HOT 3
- CommandBindings fail to bind on ItemTemplate prefabs
- INPCBinding fail if disabled before Start and enabled after DataContext is attached HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ugui-mvvm.