I’m looking to make an array of array of transforms that can be accessed from the unity editor window, how would I go about doing that? I tried using jagged arrays but they cannot be accessed through the editor window. I’m trying to do this to organize and categorize my items for a procedural generation script.
If it’s just for use in Unity Editor, you could just create multiple public variable of arrays for different “category”, and they will show up as in categories. Otherwise you can create a Serializable
class which contains a array variable, as pointed out by @MakakWasTaken in the comment above. Although, I would recommend that you not use array in C# because they are immutable i.e. cannot change it’s value after initialisation. Try to use Lists they are more handy.
using System.Collections.Generic;
[Serializable]
public class Category {
public List<Transform> items = new List<Transform>();
}
public List<Category> categories = new List<Category>();
//To get object the format will be following
var someTransform = categories[2].items[1];
var otherTransform = categories[0].items.Find(someOtherTrasnform);
However, I would not recommend using this at all because this really isn’t that useful way to organise your data. I don’t know if you plan to use it, but if it’s just for the Editor then I would recommend that you invest in an asset called Advanced Inspector it’ll help solve inspector display problems.