string GetAssetsPath()

book_4_sparkGenerated
code_blocksInput

Description

Returns the absolute path to the assets folder of the project. If the assets path is not set, the method returns null.

Usage

Use this method when you need to retrieve the location of the assets folder for the current project. This can be useful for loading resources or managing project files.

Example

// Example of using GetAssetsPath
Sandbox.Project currentProject = Sandbox.Project.Current;
string assetsPath = currentProject.GetAssetsPath();

if (assetsPath != null)
{
    // Use the assets path for loading resources
    // Example: Load a texture from the assets folder
    Texture texture = Texture.Load(assetsPath + "/textures/myTexture.png");
}
else
{
    // Handle the case where the assets path is not set
    // Example: Log a warning or set a default path
}