Page 1 of 1

[Unity] Property changed event 'lost' in child classes?

Posted: 15 Jun 2014, 00:29
by Weltista
Hi,
I've stumbled over seemingly flat surface and would appreciate any input on what am I doing wrong. :?

There is basic class (LocalOject) with one registered property (currentSpeed) and the class that inherits from it (with another registered property):
[Noesis.Extended]
public class LocalObject: Noesis.BaseComponent {

	private float _currentSpeed;
	public float currentSpeed {
		get { return _currentSpeed; }
		set	{
			if (_currentSpeed != value) {
				_currentSpeed = value;
				NotifyPropertyChanged("currentSpeed");
			}
		}
	}
...............
}

public class SpaceShip: LocalObject {
..................
	private float _max_ShieldHP;
	public float max_ShieldHP {
		get { return _max_ShieldHP; }
		set	{
			if (_max_ShieldHP != value) {
				_max_ShieldHP = value;
				NotifyPropertyChanged("max_ShieldHP");
			}
		}
	}
................
} 
Now, when I set value of property from the instance of class where property is registered, everything works great. But when I try to modify value of property that registered in parent class:
 SpaceShip myShip = new SpaceShip();
myShip.currentSpeed = 10f;

I get the following : Exception: Can't launch PropertyChanged event. Property 'currentSpeed' not registered for type 'SpaceShip'

So what must be done to correctly inherit 'property changed event' from parent class? Thanks.

Re: [Unity] Property changed event 'lost' in child classes?

Posted: 16 Jun 2014, 13:57
by sfernandez
There is nothing wrong in your code.
It is a bug in our plugin code, we will fix it for the next release.

Sorry for the inconvenience.

Re: [Unity] Property changed event 'lost' in child classes?

Posted: 16 Jun 2014, 15:09
by Weltista
Understood, thanks. Looking forward to the update then. Cheers.

Re: [Unity] Property changed event 'lost' in child classes?

Posted: 17 Jun 2014, 01:02
by Weltista
Just wanted to add that upcasting doesn't help either. Following code yields the same exception:
SpaceShip myShip = new SpaceShip();
LocalObject myObj = (LocalObject) myShip;
myObj.currentSpeed = 10f;
Can you hint on how soon you are planning to release the next version?

Re: [Unity] Property changed event 'lost' in child classes?

Posted: 18 Jun 2014, 01:40
by sfernandez
Can you hint on how soon you are planning to release the next version?
By the end of next week we will release 1.1.9 version.

Re: [Unity] Property changed event 'lost' in child classes?

Posted: 01 Jul 2014, 14:47
by sfernandez
Solved in 1.1.9 version.