- Home /
GameObject as part of class definition?
in javascript.
Is it possible to include the unity3d GameObject inside a new class? How would one go about creating instances of this new class?
thanks for any pointers or suggestions.
I think there should be no problem with what you want, but I can't tell what you're asking. Please clarify.
Answer by TowerOfBricks · Jan 30, 2011 at 04:07 PM
As Jessy, I'm not really sure what you want to do. But to include a gameObject in a new class would just be like adding a variable pointing to a GameObject
public class MyClass {
public GameObject myGameObject;
}
Creating instanced would be just like any other class: new MyClass ();
However if you want to inherit from a GameObject, that won't work, inheritance from GameObject is not allowed.
Thanks.
Essentially I want objects that have a unity3d GameObject as a component.