s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationAssetsFile System
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Assets
Assets

File System

Standard .NET file access is restricted to prevent rogue access to your files, this means you can not use System.IO.File or variants directly.

Instead, s&box provides a BaseFileSystem for several virtual filesystems that can only access files within specific game directories.

There are a few different File Systems available to use in your game. Each one writes and reads from a different location.

Data File System

FileSystem.Data is used to read and write data to a sub-directory specifically for the game that is currently running, i.e. C:\steam\steamapps\common\sbox\data\org\game\

Mounted File System

FileSystem.Mounted is an aggregate filesystem of all mounted content from the core game, the current game and its dependencies.

Organization File System

FileSystem.OrganizationData is a place to store user data across several games in your organization, i.e.

C:\steam\steamapps\common\sbox\data\org\

// If the file doesn't exist already then write some data to it
if ( !FileSystem.Data.FileExists( "player.txt" ) )
    FileSystem.Data.WriteAllText( "player.txt", "Hello, world!" );

// Read the text back into a variable from the file
var hello = FileSystem.Data.ReadAllText( "player.txt" );

:::info WriteJson and ReadJson will only work with Properties of your class unless directed not to - make sure the things you want to save are Properties!

:::

public class PlayerData
{
  	public int Level { get; set; } // Will be serialized
	public int MaxHealth { get; set; } // Will be serialized
	public string Username; // Won't be serialized

	public static void Save( PlayerData data )
	{
		FileSystem.Data.WriteJson( "player.json", data );
	}

	public static PlayerData Load()
	{
		return FileSystem.Data.ReadJson<PlayerData>( "player.json" );
	}
}

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2025-06-15. Read it rendered on the official docs.

More in Assets

Assets
Binary Serialization
Citizen Characters
Clothing
Cloud Assets
Custom Assets
First Time Setup
First-Person Weapons
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.