1 decade ago by vidja_games
I would like to get an entity's type/class.
For example I know that this works, but its just not useful for what I need to do.
I tried the following but...
So apart from making a huge switch containing instanceof or throwing the ClassName into each entity on creation, what can I do to have access to the ClassName?
For example I know that this works, but its just not useful for what I need to do.
ig.log(portal instanceof EntityPortal); //returns true as expected
I tried the following but...
ig.log(portal.constructor); //returns function () ig.log(portal.constructor.toString()); //returns function () { "use strict"; }
So apart from making a huge switch containing instanceof or throwing the ClassName into each entity on creation, what can I do to have access to the ClassName?