Variable not showing up in inspector?

EDIT: I have solved this.

So I have created this enemy class:

And If i now create a class that has Enemy in it, its not showing up in inspector?

^I’m probably doing something wrong here…

Make sure you have put [Serializable] at the top of the class, and using system at the top too.

check out this: Unity - Manual: Script serialization

for more info

EDIT: I have solved this.

Well I did get it to showup on inspector now, but without the box that you could drag and drop stuff into…

Also should I be trying to make the enemy part of the gameobject:

    GameObject a = new GameObject();
    Enemy testEnemy = new Enemy(1, 2, 3);
    a.Enemy = testEnemy;

or gameobject part of the enemy?

    GameObject a = new GameObject();
    Enemy testEnemy = new Enemy(1, 2, 3, a);
1 Like