Re: Unity: Do DependencyProperties / Control.SetBinding work
Posted: 01 Mar 2015, 15:52
Just catch the same issue. Commented out dependency property in code and it works, so I'm sure the issue is same.
The workaround is seems to work, but in my case, controls must be instantiated via .NET Activator (I have a dozens for controls defined in Unity prefabs as full type name and instantiate them via .NET Activator).
If you have any ideas how to fix it - please tell me!
UPD. Calling Noesis.Extend.RegisterNativeType(type) where type is type of Control to instantiate helps to resolve this issue. But there are some other cases where I instantiate controls via direct constructor call...
UPD 2. Added logging to AddNativeType() in Noesis.Extend: Debug.LogWarning("NosisGUI: Register type " + info.Type.FullName);
It seems that some (maybe all) UserControls inheritors is not registered. If I register them manually, they work as expected.
UPD 3. Registering manually all UserControl inheritors helps, but the error still appears for some other classes - inheritors of DependencyObject. Registering manually them still not helps, as the new issues appears...
For example, calling VisualTreeHelper.GetChild() throws exception "Native type is not registered".
If I register manually all (absolutely all) inheritors from BaseComponent, I get this error:
"Exception System.ApplicationException: Can't add a 'Assets.UI.Menus.MainMenu' to a 'UIElementCollection'" which is absolutely nonsense...
UPD 4. Registered manually all used by the game UserControls, DependencyObjects and BaseComponents inheritors, it seems the game is running now. So the issue is that NoesisGUI 1.2.0 doesn't registering custom classes (which had [Extend] attribute on them in 1.0.x/1.1.x) automatically and workaround is to do it manually.
The workaround is seems to work, but in my case, controls must be instantiated via .NET Activator (I have a dozens for controls defined in Unity prefabs as full type name and instantiate them via .NET Activator).
If you have any ideas how to fix it - please tell me!
UPD. Calling Noesis.Extend.RegisterNativeType(type) where type is type of Control to instantiate helps to resolve this issue. But there are some other cases where I instantiate controls via direct constructor call...
UPD 2. Added logging to AddNativeType() in Noesis.Extend: Debug.LogWarning("NosisGUI: Register type " + info.Type.FullName);
It seems that some (maybe all) UserControls inheritors is not registered. If I register them manually, they work as expected.
UPD 3. Registering manually all UserControl inheritors helps, but the error still appears for some other classes - inheritors of DependencyObject. Registering manually them still not helps, as the new issues appears...
For example, calling VisualTreeHelper.GetChild() throws exception "Native type is not registered".
If I register manually all (absolutely all) inheritors from BaseComponent, I get this error:
"Exception System.ApplicationException: Can't add a 'Assets.UI.Menus.MainMenu' to a 'UIElementCollection'" which is absolutely nonsense...
UPD 4. Registered manually all used by the game UserControls, DependencyObjects and BaseComponents inheritors, it seems the game is running now. So the issue is that NoesisGUI 1.2.0 doesn't registering custom classes (which had [Extend] attribute on them in 1.0.x/1.1.x) automatically and workaround is to do it manually.