Weltista
Topic Author
Posts: 11
Joined: 14 Jun 2014, 23:52

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

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):
[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.
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

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

16 Jun 2014, 13:57

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.
 
Weltista
Topic Author
Posts: 11
Joined: 14 Jun 2014, 23:52

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

16 Jun 2014, 15:09

Understood, thanks. Looking forward to the update then. Cheers.
 
Weltista
Topic Author
Posts: 11
Joined: 14 Jun 2014, 23:52

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

17 Jun 2014, 01:02

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?
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

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

18 Jun 2014, 01:40

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.
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

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

01 Jul 2014, 14:47

Solved in 1.1.9 version.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest