[Unity] Null reference exception when binding set value
Posted: 09 Jul 2014, 14:53
Hi,
I am getting the following null reference exception when changing value of text box.
I am getting the following null reference exception when changing value of text box.
This is my model classNullReferenceException: Object reference not set to an instance of an object
Noesis.Extend.GetExtendInfo (IntPtr cPtr) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisExtend.cs:1207)
Noesis.Extend.GetInstance (IntPtr cPtr) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisExtend.cs:1195)
Noesis.Extend.SetPropertyValue_String (IntPtr unityType, Int32 propertyIndex, IntPtr cPtr, IntPtr val) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisExtend.cs:974)
(wrapper native-to-managed) Noesis.Extend:SetPropertyValue_String (intptr,int,intptr,intptr)
Noesis.UIRenderer.Noesis_KeyDown (Int32 rendererId, Int32 key) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRendererImports.cs:241)
Noesis.UIRenderer.ProcessEvent (UnityEngine.Event ev, Boolean enableKeyboard, Boolean enableMouse) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRenderer.cs:248)
NoesisGUIPanel.OnGUI () (at Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs:135)
This is view[Noesis.Extended]
public class Person : BaseComponent
{
private string name;
public string Name
{
get { return name; }
set
{
name = value;
NotifyPropertyChanged("Name");
}
}
}
Am I missing something?Person person = new Person() { Name = "John" };
TextBox tb = new TextBox();
Binding binding = new Binding("Name");
binding.SetSource(person );
BindingOperations.SetBinding(tb, TextBox.TextProperty, binding);