PLCollection<T>
Need the practical walkthrough first? Start with PLCollection Guides, then use this page as the compact code reference for the collection API itself.
PLCollection<T> organizes multiple ProbabilityList<T> instances into one collection.
Use it when one list is not enough and you want a higher-level structure for named or indexed list groups.
Typical use cases
- grouped loot tables
- named dialogue pools
- encounter categories
- multi-biome spawn lists
- any system where several probability lists belong together
Core collection members
Collection basics
ItemTypeReturns the value type used by the collection and all contained lists.
CountNumber of lists in the collection.
AddListAdds an existing list or creates a new list with an optional name.
RemoveListRemoves a list by index or name.
GetListRetrieves a list by index or by name.
SetListNameRenames a list. Since names live on the underlying ProbabilityList<T>, this is the collection-friendly way to keep those names useful and consistent.
MoveListUp / MoveListDownReorders lists inside the collection.
Picking through the collection
Selection helpers
PickValueFromPicks a single value from one named or indexed list.
TryPickValueFromSafer single-pick helper when you need to distinguish missing lists from unsuccessful picks.
PickValuesFromPicks multiple values from one list.
PickValuesFromAllPicks values from all lists and merges the results into a new list.
PickValueFromAllPicks one value from each list and returns the collected results.
Maintenance helpers
Maintenance and state helpers
ClearCollectionRemoves all lists from the collection.
ClearList / ClearAllListsClears one list or all lists.
IsListEmptyChecks whether a list exists and whether it currently contains items.
RefillList / RefillAllListsRefills depletable items in one list or across all lists.
Naming vs indexing
Names are often the cleaner API.
Index-based access is fine for tightly controlled internal systems, but name-based access usually stays clearer and more maintainable when the collection represents content groups.
List names matter more than they might look at first glance.
ListName is not just an optional label for display. It is also what makes named lookup in PLCollection<T> practical, both in editor workflows and in code that retrieves or picks from lists by name.
Example
var responses = new PLCollection<string>();
responses.AddList("Friendly");
responses.AddList("Hostile");
responses.GetList("Friendly")?.AddItems("Hello", "Good to see you", "Welcome back");
responses.GetList("Hostile")?.AddItems("Go away", "Not interested", "Leave me alone");
responses.PickValueFrom("Friendly", out var line);
Related pages
Building something with PLCollection and want feedback?
If you want to compare approaches, ask about naming strategy, or sanity-check a setup, the Support page will point you to our Discord community.