Hello,
I’m trying to create a “world”, where there are different objects with different properties (Each object has a unique name that can be known by the player and belongs to two different classes (type1, type2)).
My question is, what’s the best way to assign those properties to each object, making the research by name/class performant?
- Adding a script to each object with variables “var type1”, “var type2”
- Creating custom tags for classes (and names?) and adding empty objects “type1” and “type2”, whose tags will be their values?
- Other solution?
Thank you much 
to each object for each property?
making the research by name/class performant?
What do you mean? I don’t understand your ultimate objective.
UPDATE:
Well to begin with I think you mean you want to implement a ‘search’ function, not a ‘research’ function. Then you will need some kind of data structure to hold all the labels (string)s that you want to hold, and some kind of algorithm to search the data structure. You should google for ‘string search algorithm’. Unfortunately searching algorithms can be quite complex and I haven’t studied them since college. At the very least you could check each string in the array for the substring:
public class LabelSearcher {
public static List<string> labels;
//called whenever the search field changes
void OnSearch(string substring) {
List<string> matchList = new List<string>();
foreach(string label in labels) {
if(label.IndexOf(substring) >= 0) {
matchList.Add(label);
}
}
// TODO: display match list to user!
}
}
}
At the start of game each monobehaviour with properties will need to register its labels. That is, something like…
// custom labels set in the editor
public string myLabel1, myLabel2;
void Start() {
LabelSearcher.labels.Add(myLabel1);
LabelSeracher.labels.Add(myLabel2);
}
I hope this helps.