[Unity] Property changed event 'lost' in child classes?
Posted: 15 Jun 2014, 00:29
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):
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:
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.
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):
Code: Select all
[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");
}
}
}
................
}
Code: Select all
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.