Item.cs
public class Item
{
public int itemId;
public string itemName;
public string itemDescription;
public string itemType;
}
Food.cs
public class Food
{
public Item Apple;
public Item Plum;
}
Im trying this:
Food food = getFood();
string wantedObj = getObjName();
print(food." wantedObj ".itemDescription);
So is it possible to do something like this? I don't know wantedObj
, it could be Apple
or Plum
, so we need to get info depends on wantedObj
string.
I don't know how to find class object by object name.