Description
The LoadedPackages
property provides access to all the loaded sbox.game
packages for the current session. These packages are essential for loading entities that can be utilized by various tools within the editor environment. This property is static, meaning it is shared across all instances and can be accessed without creating an instance of the GameData
class.
Usage
To access the loaded packages, simply reference the LoadedPackages
property from the GameData
class. This will return an array of Sandbox.Package
objects, each representing a package that has been loaded into the session.
Example
// Accessing the loaded packages
Sandbox.Package[] packages = Editor.GameData.LoadedPackages;
// Iterate through the loaded packages
foreach (var package in packages)
{
// Perform operations with each package
Console.WriteLine($"Loaded package: {package.Name}");
}