Actor Classes LoadContent

Dec 4, 2009 at 1:58 PM

I read some chapters in the book 3D Game programming book with Microsoft Silverlight 3.It is realy cool.But few issues are not clear for me about using Actor classes.For example I don't know when their LoadContent methods are called so I tried calling them in code for example _ship.LoadContent() but I get object not set to reference method because ContentManager is null.

So my question is when Actor class LoadContent is called and If I want to call it manualy how to make sure that ContentManager will not be null?

Dec 4, 2009 at 9:14 PM

I didn't notice you had the Question published here as well (ref. thread on :

Copy of answer from there:


this is a complete oversight on my behalf in the Engine.
Sorry about that.

Over the last couple of months a lot has been refactored and apparently, the Actor system has been forgotten a bit. I will put this up as a bug on our taskboard. One thing though you could do to overcome the problem, for now at least; when you create the Actor from your Game class, you could add a dependency on your constructor to IContentManager and pass along the one you have in the Game class and use that. This is of-course something that will be fixed and handled automatically, so you don't have to worry about it.


I've put it on GitHub issues list that we use for work: 

Dec 5, 2009 at 7:00 AM

Thank you for your respond and being concerned about my problem.I post my question here too because I thought I won't get any respone in Silverlight Forum..sorry for that.

I used your suggestion and it solved my problem...About Actor classes as I understand they are used to make the code more object oriented but it is not compulsory to use them right?

Dec 5, 2009 at 1:39 PM

You don't need to use them, the purpose is as you say, make it more object oriented - and provide a better separation.

I'm in the midst of looking over the Actor system, including how Game actually works and will look into this at the same time.