How to get "name" of a SceneObject?
by Edward Rotberg · in Torque 3D Professional · 12/31/2009 (2:51 pm) · 3 replies
Hi,
I've created a custom class that is a SceneObject and has a custom RenderDelegate. I would like to instantiate more than one of these objects from the World Editor, but at OnAdd() time, I would need to be able to differentiate between individual instances of these objects, so that I could load unique data for each instance. To my knowledge, the only unique data that I would have at OnAdd() time is the name of the object that you give it in the World Editor when placing it into your level. How can I get this name at or before OnAdd() time?
Alternatively, should I be sub-classing something other that SceneObject, perhaps another sub-class of SceneObject that has the functionality that I need?
Thanks in advance,
= Ed =
I've created a custom class that is a SceneObject and has a custom RenderDelegate. I would like to instantiate more than one of these objects from the World Editor, but at OnAdd() time, I would need to be able to differentiate between individual instances of these objects, so that I could load unique data for each instance. To my knowledge, the only unique data that I would have at OnAdd() time is the name of the object that you give it in the World Editor when placing it into your level. How can I get this name at or before OnAdd() time?
Alternatively, should I be sub-classing something other that SceneObject, perhaps another sub-class of SceneObject that has the functionality that I need?
Thanks in advance,
= Ed =
About the author
#2
01/04/2010 (10:17 pm)
Or use the ( script ) class name, or add a new type string field, etc.
#3
01/05/2010 (2:55 pm)
It should be noted that the name of an object may not be transmitted from server to client. So as long as all scripts depending on a name are executed on the server, that is not a problem, otherwise you are going to need to pack up the name and send it across to clients.
Torque 3D Owner Edward Rotberg
= Ed =