Great asset, very straightforward to setup directly in the inspector, but if I could make one suggestion, when binding to text, would be nice if I could add a modifier in the inspector rather than having to do it in code.

e.g.

Observer
Text

Source
Float

This sets text.string=float.toString();

Would be useful if in the inspector could have the equivalent of text.string="some text"+float.tostring();

Thank you for the suggestion. We have considered something similar but ultimately we decided against it for the first release of the asset due to efficiency concerns. We will keep searching for a solution that scales well, aiming to include it in a future release.

Hi, just quick question regarding import Ez Assets. All packages are great

Maybe you know this issue but for sure, If new project ic created in Unity 2017.1.1p3 (mac osx 10.12.6) (2d, disabled analytics) and selected to add only these assets (Bind, DataManager, DefineSymbols, Polly) Im getting this error:

Assets/Plugins/Ez/Bind/Scripts/Editor/BindResources.cs(5,10): error CS0234: The type or namespace name `Internal' does not exist in the namespace `Ez'. Are you missing an assembly reference?

Assets/Plugins/Ez/Bind/Scripts/Editor/BindResources.cs(14,23): error CS0246: The type or namespace name `GTexture' could not be found. Are you missing an assembly reference?

Only fixed when Im import EzBind again manually. Which package from (DataManager, DefineSymbols, Polly) break the bind asset source files? Must be something about shared folder. When fix will be available on asset store? Or do you already have fixed package?

Let me now if problem is confirmed or if you need more info. Thank you

We are aware of this issue. In order to reduce project clutter and not have duplicate resources that are used separetely by each asset, we have a common infrastructure for handling the editor/inspector and its resources. An unfortunate side-effect has been the issue you encountered - caused by the evolution of the editor infrastructure in the case of different assets.

A major update and overhaul of all assets is currently in production - this will bring big changes both on the editor side as well as runtime optimisations and new functionalities. To avoid problems such as the one you have encountered, we will update all assets at once so, at this time, we cannot give you a definitive timeframe for the update - we want it to be as soon as possible, of course .

In the mean time, to avoid the editor errors, a simple workaround is to manually import our assets in a specific order:
- always import Ez Define Symbols first
- import Ez Ads/Ez Data Manager/Pooly - generally in any order, but we can confirm this works
- always import Ez Bind last

Hello @sharkyro - I had a question before i buy EZ Bind - I have created a data system based on scriptable objects - I store almost all of my data in scriptable objects and have a system that can serialize and deserialize a list of scriptable objects to disk for persistance/saving/etc. I would like to buy EZ Bind and do data binding from these scriptable objects to things in the game. Does EZ Bind support binding to source data from a scriptable object?

At the moment, the only limitation is that it is not permitted to bind on Arrays/Lists nor on their members. You can, however, bind serializable custom classes - and, if a serializable list or array is member of that class, it will be synchronized as well (but only in whole, you still can't bind members). Since ScriptableObjects are serializable, you shouldn't experience any problems.

I purchased EzBind - but i noticed it does not have support for Unity 2017.3's Assembly Definitions files. I have a large project and not having these Assembly Definitions files really drags down compile times. Is this something you guys are looking into?

I tried adding some into the folder structure but it looks like you guys have circular dependencies between the "shared" code and the other Ez tools (i also installed EzDefine)

This will make Assembly Definitions impossible to implement untill you fix the circular dependencies.

Happy to provide any guidance on what needs to be fixed and/or where the place the Assembly Definitions files.

Also it looks like you cannot move the top level Ez folder to anywhere else in the project - you get errors when you open the control panel from the Quick tooling saying Texture is Empty and/or not finding the settings scriptable objects.

I have a large project and not having these Assembly Definitions files really drags down compile times. Is this something you guys are looking into?

I tried adding some into the folder structure but it looks like you guys have circular dependencies between the "shared" code and the other Ez tools (i also installed EzDefine)

This will make Assembly Definitions impossible to implement untill you fix the circular dependencies.

Happy to provide any guidance on what needs to be fixed and/or where the place the Assembly Definitions files.

Click to expand...

All Ez tools were designed to have a shared editor code base for the Inspector and the Control Panel. There is nothing to fix, as the system was designed like this to make the editors consistent.

At the moment, we don't have plans to support Assembly Definitions - they're too new and they are not a suitable solution for the vast majority of our users - as per Unity's recommendation this should either be implemented at project level or not at all.

If you want to implement this yourself, I can suggest we move this discussion to our support email (support@ezentertainment.eu) and we will do our best to provide assistance.
If the support for this feature is a deal-breaker for you, the only option is to offer you a refund.

Also it looks like you cannot move the top level Ez folder to anywhere else in the project - you get errors when you open the control panel from the Quick tooling saying Texture is Empty and/or not finding the settings scriptable objects.

Click to expand...

This should not happen; all tools work correctly, even when moved from the default location (this was tested on Unity 5.6 and 2017.x). It might be a Unity bug (fixable by restarting Unity).

Makes sense on the list thing - If your data is stored in a list, do you guys have a recommended way to databind to get around this limitation? Essentially what i'm trying to do is i have a List of a custom class and i'd like to spawn a prefab for each item in that list and then data bind the data for each item in the list to the data on the prefab such that the prefab can update itself with the specific data its been handed?

As for the Assembly def's happy to take it to support e-mail i'd really like to get this implemented as it really speeds up our workflow compile times when we don't have to wait for all our 3rd party assets to recompile each time. I'll reach out.

As for the moving of the folder it looks like it took 2 restarts - not sure why - it recompiled after each restart and only on the 2nd restart after the move of the Ez folder into the plugins folder did it actually open the control panel without any errors. Thanks!!!!

I look forward to getting into the databinding aspect now - and we can workout the assembly defs via e-mail.

@sharkyroEssentially what i'm trying to do is i have a List of a custom class and i'd like to spawn a prefab for each item in that list and then data bind the data for each item in the list to the data on the prefab such that the prefab can update itself with the specific data its been handed?

Click to expand...

This premise is really simple and is something that we are using all the time - but not for "setup" data, only for variables that can change at runtime

We developed EzBind as a quick and efficient way to synchronize, at runtime, variables that are value types - because those are the real pain to synch. If you're only working with custom data classes, why bind when you can just get a reference once and be done with it?
Also, are you binding to data that is being modified at runtime? Based on your description, it doesn't seem you're in need of data binding (at least not in the aforementioned scenario).

@sharkyro - Well this is just one of the examples i'm trying to bind for - i have other situations where i'd like binding that is similar to your examples.
But this is "Runtime" binding for a list - the list of data starts empty and during runtime is filled with data through actions taken by the user - when the list is updated i'll be spawning prefabs for each list item and take the data injected into the list and setting up the prefab with that list entries data - the prefab will have editors inside of it that edit some of the data which i'd like to be 2 way bound back to the source data (which is in a list in a scriptableobject) and then my scriptableobject data system will be saving that list data to disk at intervals or when the user initiates a save.

Maybe i'm missing something but it seems like data binding would be really helpful to decouple all of that and allow it to be setup in the inspector without writing much, if any, code.

@Rocktavious Don't worry, you're not missing anything - your point of view is quite clear. I was just explaining our philosophy behind EzBind - to facilitate syncing value types and to have a one-to-many model (one source, many observers).

Just a quick example on our approach, just to give you an idea, nothing else - let's say for generic player data (name, health, currency, xp, etc...). We have all of these on a central, easily accessible (both from code and Inspector) singleton reference (we have EzDataManager for this exact purpose). All variables are setup as sources on different binds. Scripts that are responsible for changing values work directly on the central reference (the bind source). Anyone else (scripts, UI) is just updated when the source value changes.

Important observation: no 2-way binding, you need a new bind (except for references, see below). Common scenario: 1 source, 20 observers, several listeners. To have 2-way binding would bring unjustifiable overhead by checking the observers for changes, as well. And any debugging would be a major pain.

All of the above doesn't mean EzBind won't work with references (for serializable custom data types). Take a look at the example below:

Code (CSharp):

[Serializable]

publicclass CustomDataClass

{/* all your data */}

[Serializable]

publicclass CustomDataList

{public List<CustomDataClass> myList;}

publicclass DataHolder : MonoBehaviour // OR ScriptableObject

{

public CustomDataClass myData;

public CustomDataList myDataList;

}

I think it covers your scenario. A few key notes:

You can bind variables of CustomDataClass (DataHolder.myData) or CustomDataList (DataHolder.myDataList), but not individual List members

Since both CustomDataClass and CustomDataList are reference types, EzBind will pass around the reference to the source, not a copy! Weather you like it or not, any changes to observer(s) will affect the source - as explained above, this is something we always try to avoid. In this case there's no overhead.

DataHolder must inherit from Unity's Component or ScriptableObject classes

@sharkyro - Your example is almost identical to what i'm trying to do - but i think the key is `EzBind will pass around the reference to the source, not a copy! Weather you like it or not, any changes to observer(s) will affect the source.` and while you say this is something you always try to avoid - i think in my case this is exactly what i want, because i can guarentee that there will only be 1 observer spawned for each item in the list.

It sounds like what i would do is have CustomDataClass as a property on a top level controller script of my prefab that the spawning system spawns that prefab and sets the data for the item in the list it spawned for somehow (was hoping EzBind could do this part, and maybe i still can with a bit of code and an "index" into the list given at spawn time, by binding to the list and pulling out the index item) and then inside the prefab all the sub gameobjects and elements can bind to variables and things within the CustomDataClass? Seems like that would achieve the decoupling i want such that the prefab doesn't have to know about the list (or might but know how to get its index) and the things inside the prefab don't have to know where their data comes from, just that some variable will be "bound/updated" for them and they can display it, keeping nice separation of concerns.

Thanks for working through this with me. I think i have a clear path forward to test out this type of databinding in my project!

... i think in my case this is exactly what i want, because i can guarentee that there will only be 1 observer spawned for each item in the list.

Click to expand...

This behaviour is 100% not a problem as long as you are aware of it and it is what you need.

Unfortunately, the approach you have described won't work out of the box.

Before making a different suggestion, I need to understand exactly how your data list works. Generally speaking, we pool prefabs and we spawn their clones - so we have 1 pooled prefab, but we can spawn any number of its clones. In the data list will there be one entry for each prefab or one entry for each clone of the prefab (or there will be only 1 clone/prefab so it's the same thing)?

@sharkyro It'll be a single prefab that needs to change its data when spawned to the data for 1 item in the list.

Here is basically a trimmed down (trival but hopefully illustrates the want) example:

Code (CSharp):

[Serializable]

publicclass CustomData {

publicstring title;

publicstring description;

}

publicclass DataManager : ScriptableObject{

public List<CustomData> DataList;<- there will be multiple different CustomData items inthis list

}

publicclass SpawnableData : MonoBehaviour {

public CustomData Data;

void OnSpawned()

{

...apply the data and/or use binds to sub components to fill their GUI elements ...

}

}

So then some spawning mechanism (pooly + custom code probably) will spawn the prefab 1 time for each of the items in the DataManager's DataList that has the SpawnableData behavior on it and somehow injects the data for the index it spawned for into the SpawnableData's Data reference. The the rest of the system takes over either through code or data binding the fields in CustomData of the SpawnableData field to other sub components (GUI elements). So the sub components don't have to know anything about the DataManager and we dont' have to hook directly into the DataManager, just the prefab for the SpawnableData has the bindings to the GUI elements - such that if i provide a UI element for the field "title" then it'll update the specific CustomData's title field reference in the DataManager - so my scriptableObject serialization system can save the changes to disk and everything is decoupled nicely.

HI Alex, you seem to have a really cool Asset here! I want to inquire about its performance. I am currently using an in-house made solution for biding and MVVM, it uses reflection to set and update values, for small screens with a dozen binds its working fine but I found myself cornered on how many binds I can use without causing frame stuttering when turning on the objects(first set of binds value).

The situation is a character selection in a 4 player split screen game, each character selection has ~70 binds, a single player already has a stutter when enabling this UI object, 4 player(~280 binds) is an unbearable 1s of a frame freeze.

Performance wise, can I expect something better than straight reflection out of EZ Bind?

Also, is there any platform limitation? I guess PS4, Switch, XOne, all should work fine.

@Rocktavious You won't have the option to select members of CustomData class in the inspector (only whole CustomData variables).

You could de-structure the DataList inside the DataManager and use binds to pass around these references (that will work 2-way, as you want them). My suggestion would be to start playing a bit with the example scene and then gradually introduce your own scenarios and see just how you can integrate EzBind. Then you can see what works for you and what doesn't and, based on that, we can take the discussion further.

HI Alex, you seem to have a really cool Asset here! I want to inquire about its performance. I am currently using an in-house made solution for biding and MVVM, it uses reflection to set and update values, for small screens with a dozen binds its working fine but I found myself cornered on how many binds I can use without causing frame stuttering when turning on the objects(first set of binds value).

The situation is a character selection in a 4 player split screen game, each character selection has ~70 binds, a single player already has a stutter when enabling this UI object, 4 player(~280 binds) is an unbearable 1s of a frame freeze.

Performance wise, can I expect something better than straight reflection out of EZ Bind?

Also, is there any platform limitation? I guess PS4, Switch, XOne, all should work fine.

Indeed, EzBind is making use of reflection, however we have it heavily optimized. All the expensive work is done on initialization (so scene loading takes a bit longer), but updating values is done quickly and efficiently.

In your case, have you run Unity's profiler to check where the bottleneck is? Based on your description, it may be the reflection but it could also be due to rendering. Are your binds one-to-one and what are you binding - our terminology for binds might differ (see below)?

There are no platform limitations. We are focused mainly on mobile development ourselves, so we made sure that EzBind is optimized and performs well in the mobile environment. We also have clients developing for PS & Xbox and there were no performance issues.

Binding on properties is supported at the moment, as long as the property is fully defined (has both getter & setter). A private/protected setter would make the color property above available for binding. Just be careful not to set properties with private getters as sources or properties with private setters as observers - although the configuration will be accepted, the binds will not work properly.

Unfortunately, it's an asset store bug. We've opened a ticket almost a week ago but still have no solution from Unity. As an alternative, drop us an email at our support address (support@ezentertainment.eu) and we'll send you the latest EzBind version. Please be so kind as to include your invoice number in the email.

Hey @sharkyro I'm back again - after fumbling to try and get EzBind to work in my use case, i had to give up and move to something else, but now i'm back and have time again to try and solve this. I'd like to re-explain my situation -

I have 2 Scriptable objects

Code (CSharp):

publicclass CustomData : ScriptableObject {

publicstring Title;

publicstring Description;

}

publicclass CustomDataList : ScriptableObject {

public List<CustomData> Items;

}

The idea being that you create a bunch of CustomData things and then maybe throw a few of them into the CustomDataList - and hand to some UI Manager the CustomDataList SO so it can take each item in that list and spawn a prefab for each - i've blocked code for that generic spawning of a list to something like this

Code (CSharp):

publicclass UIManager : MonoBehaviour

{

public CustomDataList Data;

public UIItem Prefab;

privatevoid OnEnable()

{

foreach(CustomData item in Data.Items)

{

UIItem obj =Object.Instantiate<UIItem>(Prefab, transform);

// How do i assign CustomData to the spawned objects binds / how can i even setup the binds?

}

}

}

So the 2 problems i'm having is:
1: How do I setup binds on the UIItem prefab object to bind to data of CustomData (that will be dynamically set at runtime)
2. How do I tell the binds configured on the prefab to use "this instance" of CustomData you've been spawned for without having to write something like CustomDataHolder and apply that to the prefab.

Code (CSharp):

publicclass CustomDataHolder : MonoBehaviour {

public CustomData Data;

publicstring Title {

get{return Data.Title;}

}

}

The sticky point for me is that it would be super nice to have this kind of spawn a object for each item in a list and have the databinds work for that specific item in the list this prefab was spawned for to other parts of the prefab's components without having to write any code as a concept in EzBind.

This would allow for a fairly generic system to spawn a list of things (maybe even pooly - if it supports spawning for list.Count times) and then you only need to setup the binds on the prefab via the inspector and then every new CustomData SO you create, all you have to do is add it to the list in CustomDataList and when the game starts up it'll spawn that extra thing into the UI with the prefab showing its data (and if a designer wants the prefab to expose more fields of CustomData - they can do so by adding more binds and not have to write code in CustomDataHolder to expose the vars for binding - such as exposing the Description field from the original CustomData object).

Hi @Rocktavious !
I would recommend doing this with the help of local binds. Local binds work just like regular binds, but they only work as long as the GameObject holding their script is active & enabled. The advantage they bring is that they only work as long as needed and they only require locally unique names (unlike global binds configured on EzBind/EzBindExtension).

Just set up an EzBindLocalBinds script on your prefab and make the necessary configuration. These binds only allow linking on their own GO and on ScriptableObjects.

Let's go with your example and assume 2 local binds called "LocalTitle" and "LocalDescription" configured on the prefab. They both have observers on configured via the inspector and need to have the source assigned after being created (as their source SOs are dynamically created). It can be done like this:

Code (CSharp):

publicclass UIManager : MonoBehaviour

{

public CustomDataList Data;

public UIItem Prefab;

privatevoid OnEnable()

{

foreach(var item in data.Items)

{

// take note that UIItem must inherit from UnityEngine.Object

UIItem obj = Instantiate<UIItem>(Prefab, transform);

var localBinds = obj.GetComponent<EzBindLocalBinds>();

// Set item.Title as source for the local bind LocalTitle:

localBinds.AddSourceToLocalBind("LocalTitle", item, "Title");

// Sets item.Description as source for the local bind named "LocalDescription"

This would allow for a fairly generic system to spawn a list of things (maybe even pooly - if it supports spawning for list.Count times) and then you only need to setup the binds on the prefab via the inspector and then every new CustomData SO you create, all you have to do is add it to the list in CustomDataList and when the game starts up it'll spawn that extra thing into the UI with the prefab showing its data (and if a designer wants the prefab to expose more fields of CustomData - they can do so by adding more binds and not have to write code in CustomDataHolder to expose the vars for binding - such as exposing the Description field from the original CustomData object).

Click to expand...

As explained above it can be done, but it needs a little bit of code.
As for Pooly - just like EzBind, it was designed to be an Editor Extension - thus it is meant to work with Transforms. Maybe in the future that will change, as ECS (Entity Component System) will become widespread, but right now it is not feasible to do so.

Since these 2 are, by far, the questions we receive most often, I will take a bit of time to go into a detailed answer and clarify matters as best as I can.

1. Two-way bindingHow it works now: As you know, EzBind is not 1-to-1 binding, instead it is 1-to-many (1 source, many observers). Every frame, the system checks if the value of the source has changed and, if it did, it automatically updates the values of the observers and invokes the listener methods.

Implications of 2-way binding:The good: we get 2-way binding. Yay!The bad: before, there was 1 check/bind (the source). Now we have 1 for each observer, as well. 10 observers = 11x overhead; 20 observers = 21x overhead; etc. This happens, of course on each individual bind! Our asset is meant to work well on mobile; such a drop in performance is not acceptable! The ugly: 1 source, 10 observers. In the same frame, the values of observers 2, 4 and 8 change. Which one takes precedence? What should the bind do? (additional overhead in the form of priorities is not an option)

The alternative: Place your source on a script that is universally accessible and work with it directly. We've designed EzDataManager to do just that (and much more), but you can easily have global variables in an easily accessible location.
And if you absolutely MUST bind 2-way (in our expericence, we've only encountered this need when working with input-fields), you can create a second bind pointing the other way around.

2. Binding on CollectionsHow it works now: You can bind on collection items, with some limitations, as described in my post above. You can do this on local or global binds, it doesn't matter, as long as your collection class inherits from UnityEngine.Object.

If you want to bind on collection items, you will have to do it through code, for the time being. You can check out the manual to see the available methods for adding source/observers to binds.

Thank you @sharkyro that works beautifully - and since i already needed specialized code to spawn/Instantiate each of the items from the SO list of items it fits really nicely into the system. I was not aware of the LocalBinds improvements (had to update EZBind)

@sharkyro I think i found a bug with EzBind (i'm using version 2.2) with Unity 2017.4 LTS

Repro:
- create a prefab with a local binds component
- select the prefab asset in the project view
- add new bind in the local binds component
- close unity
- reopen unity
- select the prefab asset in the project view
- notice your new bind on the local binds component did not get saved

It seems like changes to the component when modified on the prefab asset are not automatically saving their data to the prefab asset - BUT if you drag the prefab into the scene, make the changes and the hit the Apply button to save the prefab changes back to the asset it does save the data. I have validated this by watching whats in the prefab asset file when using text format asset files and can clearly see this happening without shutting unity down.

Let's say I associate an int number of coins with a UI Text coin counter. I bind them. Okay, I collect coins, they are displayed on the counter.
But what if I want coin number change not to be instantly displayed, but lerp it using a coroutine, e.g. on collecting a pack of 100 coins, the counter scrolls from 0 to 100 (for 2 seconds).
Does it make Ez Bind useless?

@hottabych - You could write a generic behavior that does the lerping - and then have ezbind to set the "next value" on the Lerping behavior and that behavior slowly lerps its UI text value on each update trying to keep the UI in-sync with the value of its "next value" that ezbind is setting. Cheers

Hi there, based on what I am reading looks like this will not be possible to achieve with EZ Bind, but since this is core to my data I am wondering whether I can do it somehow. My easy save 3 savegame data is loaded in a structure which I call GameData. This is defined like :

[Serializable]
public class GameData {
// This is simply the name of the file where the player data is stored
public string pd = "GameData.es3";
public Player player;
}

And Player is like :

[Serializable]
public class Player {
public int level;
public int xp;
}

I want to be able to use the player xp as source (GameData.Player.xp). I am only able to reach to Player through the data bind, but I can't get a level deeper to reach xp, which is a really big problem for the way my data classes are designed.

This kinda looks to me like a very casual scenario to data binding frameworks though, so I am wondering whether I am missing something. Is there a way to do that ?

I do have a way of doing this by setting GameData as a MonoBehavior class and lose the containing manager gameobject. It does work this way, but it would be nice if I could go deeper into variables through object references.

Oops...

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.