Game Development Community

Using actor from ActorComponent

by Do Not Delete · in Torque X Platformer Kit · 10/23/2007 (8:27 pm) · 1 replies

I'm modifying PlayerController.cs and would like to use the actor from ActorComponenet.

For example I want to be able to do something like this:

actor.Reset();

I have declared actor at the top like this:

ActorComponent actor;

But I have an exception that says:

Object Reference not set to an instance of an object.

What can I do to fix this problem?

#1
10/26/2007 (10:37 am)
What you have done is referenced a Class not an object. Basically you telling ALL the Actor's to reset. If you want to do that run a loop to reset them all. If you want only one to reset then find a variable holding an Actor then reset it (if it's public)