Custom Inspector Issue

Updated on September 28, 2016 in [A] Unity Scripting
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
1 on September 28, 2016

Hey guys!
So i’m a noob in inspector scripting, and i need some help

let’s way i have this class:


public class Wave

{

public List<Transform> spawnPoint;

public List<GameObject> enemies;

}

and in another class, i have this:


public Wave[] wave;

I want to display these lists in the inspector, but like this:

Waves: 1

Wave 1:

Enemies: 3

Enemy 1 [Object Field]
Enemy 2 [Object Field]
Enemy 3 [Object Field]

SpawnPoints: 1

SpawnPoint 1 [Object Field]

I really don’t know if i was clear, but i’m really confused here.

I’m assuming i would need a for loop for the waves, as well as one for the enemies and one for the spawnpoints.

How can i do the display inside the for loops?
How can i resize the lists to fit the number i put in?

-Pork

[Sorry if this is messy]

  • Liked by
Reply
0 on September 28, 2016
public class Waves{
   public List<Object> enemy = new List<Object>();
   public List<Object> spawnPoint = new List<Object>();
}
public Waves[] waves;

I mean this is how to do. But i dont get why you need this: “I’m assuming i would need a for loop for the waves, as well as one for the enemies and one for the spawnpoints.” I thought you just want to help in the inspector.

For the question: “How can i resize the lists to fit the number i put in?” it auto resizes in the inspector, i think, maybe, not sure.

  • Liked by
Reply
Cancel