Special List Path
List path from a method
//Testing custom property
public class Player : Monobehaviour
{
//The list
List<HelmetData> HelmetDataList;
//The method
public List<HelmetData> GetMyList(){
return HelmetDataList;
}
//Select from the return of the method GetMyList()
[Dropdown("GetMyList()", "HelmetName")]
public HelmetData Helmet;
}
//Testing instance variable
public class HelmetData : Monobehaviour
{
public string HelmetName
public string HelmetID
public string HelmetMaterialName
}
List path from a method with string arguments
//Testing custom property
public class Player : Monobehaviour
{
//The lists with different rareness
List<HelmetData> CommonHelmetDataList;
List<HelmetData> RareHelmetDataList;
List<HelmetData> SuperHelmetDataList;
//The method that return HelmetData List
public List<HelmetData> GetMyList(string rareness){
switch(DataListName)
{
case "Common":
return CommonHelmetDataList;
case "Rare":
return RareHelmetDataList;
case "Super":
return SuperHelmetDataList;
default:
return CommonHelmetDataList;
}
}
//Select from common helmet list
[Dropdown("GetMyList( \"Common\" )", "HelmetName")]// use \" instead of "
public HelmetData Helmet1;
//Select from Rare helmet list
[Dropdown("GetMyList( \"Rare\" )", "HelmetName")]// use \" instead of "
public HelmetData Helmet2;
//Select from Super helmet list
[Dropdown("GetMyList( \"Super\" )", "HelmetName")]// use \" instead of "
public HelmetData Helmet3;
}
//Testing instance variable
public class HelmetData : Monobehaviour
{
public string HelmetName
public string HelmetID
public string HelmetMaterialName
}
List path from static class
//Testing custom property
public class Player : Monobehaviour
//Select from the the static list of HelmetDatabase class
[Dropdown("HelmetDatabase.HelmetDataList", "HelmetName")]
public HelmetData Helmet;
}
public class HelmetDatabase : Monobehaviour
{
public static List<HelmetData> HelmetDataList;
}
//Testing instance variable
public class HelmetData : Monobehaviour
{
public string HelmetName
public string HelmetID
public string HelmetMaterialName
}
Last updated