Sandbox Developers SDK - Reference
SandboxSDK Class
The SandboxSDK
class provides a set of tools to interact with Sandbox's developer APIs, including authentication, user data, assets, collections, libraries, and more.
Initialization
Initialize(OAuthSettings newSettings)
Initializes the SDK with the provided OAuth settings.
Parameters:
newSettings
: Authorization settings object.
Usage: Call this before using any other SDK methods.
Authentication
RequestAuthorization()
Attempts to load stored credentials or starts the browser authentication flow.
Returns: UniTask<bool>
— true if authorized.
RequestToken(string code, CancellationToken cancellationToken = default)
Requests a token using the provided code.
Parameters:
code
: OAuth code.cancellationToken
: Optional cancellation token.
Returns: UniTask<bool>
Logout(CancellationToken cancellationToken = default)
Logs out the currently authenticated user.
Returns: UniTask<bool>
User Info
GetLoggedUserId()
Returns the ID of the currently authenticated user.
Returns: string
GetUser(string userId, CancellationToken cancellationToken = default)
Fetches user details by ID.
Returns: UniTask<UserResponse>
GetUserAvatar(string userId, CancellationToken cancellationToken = default)
Fetches the avatar data of the user.
Returns: UniTask<AvatarData>
Assets
GetPublicAssets(...)
Returns a list of public assets.
Parameters include:
limit
,searchAfter
,search
,query
,cancellationToken
Returns: UniTask<AssetsResponse>
GetCollectionAssets(...)
Returns assets belonging to a specific collection.
Returns: UniTask<AssetsResponse>
GetLibraryAssets(...)
Returns assets belonging to a specific library.
Returns: UniTask<AssetsResponse>
GetInventoryAssets(...)
Returns assets owned by a user.
Returns: UniTask<AssetsResponse>
GetAssetById(string assetId, CancellationToken cancellationToken = default)
Downloads a specific asset.
Returns: UniTask<GLTFData>
PreloadAssets(List<string> assetIds, Action<int, int> onLoadProgress = null, CancellationToken cancellationToken = default)
Preloads a list of assets and provides a callback for progress.
Returns: UniTask
InstantiateAsset(string assetId, string name = null, CancellationToken cancellationToken = default)
Instantiates a GameObject by asset ID.
Returns: UniTask<SandboxAsset>
Collections
GetCollections(...)
Fetches available collections.
Returns: UniTask<CollectionsResponse>
Libraries
GetLibraries(...)
Fetches available libraries.
Returns: UniTask<LibrariesResponse>
Inventory
GetInventoryAvatars(...)
Returns all avatars owned by the user.
Returns: UniTask<AvatarsResponse>
GetInventoryLands(...)
Returns all lands owned by the user.
Returns: UniTask<LandsResponse>
GetSand(...)
Returns the SAND token balance of the user.
Returns: UniTask<SandResponse>
Social
GetFollowers(string userId, CancellationToken cancellationToken = default)
Lists the followers of a user.
Returns: UniTask<List<SocialUser>>
GetFollows(string userId, CancellationToken cancellationToken = default)
Lists the users followed by a specific user.
Returns: UniTask<List<SocialUser>>
GetFriends(string userId, CancellationToken cancellationToken = default)
Lists friends (mutual follows).
Returns: UniTask<List<SocialUser>>
GetFollowRequestsReceived(string userId, CancellationToken cancellationToken = default)
Lists follow requests received.
Returns: UniTask<List<SocialUser>>
GetFollowRequestsSent(string userId, CancellationToken cancellationToken = default)
Lists follow requests sent.
Returns: UniTask<List<SocialUser>>
GetBlockedUsers(string userId, CancellationToken cancellationToken = default)
Lists blocked users.
Returns: UniTask<List<SocialUser>>
FollowUser(string userId, string otherUserId, CancellationToken cancellationToken = default)
Follows another user.
Returns: UniTask<bool>
UnfollowUser(string userId, string otherUserId, CancellationToken cancellationToken = default)
Unfollows a user.
Returns: UniTask<bool>
BlockUser(string userId, string otherUserId, CancellationToken cancellationToken = default)
Blocks a user.
Returns: UniTask<bool>
UnblockUser(string userId, string otherUserId, CancellationToken cancellationToken = default)
Unblocks a user.
Returns: UniTask<bool>
AcceptFollowRequest(string userId, string otherUserId, CancellationToken cancellationToken = default)
Accepts a follow request.
Returns: UniTask<bool>
RejectFollowRequest(string userId, string otherUserId, CancellationToken cancellationToken = default)
Rejects a follow request.
Returns: UniTask<bool>
Notes
- All methods marked with
AuthenticationException
require a successful login. - Most methods support cancellation via
CancellationToken
.
Namespace: Sandbox.Developers
Dependencies: Cysharp.Threading.Tasks
, Sandbox.Developers.Models
, Sandbox.Developers.Importers
SandboxAsset Class
The SandboxAsset provides the logic to import assets and manage animations for assets.
Fields
initialAnimation
Specifies the initial animation for the asset.
AnimationClips
Returns the list of all the animation clips of the asset.
AssetId
Returns the asset id of the object.
Importing / Cloning
ImportAssetById(...)
Imports an asset by its id and creates the model hierarchy.
Returns: UniTask
Clone(...)
Clones an asset with the same hierarchy.
Returns: UniTask
Animations
IsPlayingAnimation(string animationName)
Checks whether the specified animation is currently playing.
Parameters:
animationName
(string): The name of the animation to check.
Returns:
true
if the animation is playing.false
otherwise.
HasAnimations()
Checks if the asset has any animation clips available.
Returns:
true
if animations exist.false
otherwise.
PlayAnimation(string name, bool loop, float crossFade)
Plays a specific animation by name.
Parameters:
name
(string): The name of the animation to play.loop
(bool): Whether the animation should loop.crossFade
(float): Set the time for blending from the existing to the new animation clip. Default 0.
StopAnimation()
Stops the currently playing animation.
Namespace: Sandbox.Developers.Importers
Dependencies: Cysharp.Threading.Tasks
, Sandbox.Developers.Models
For more information, see the Sandbox Developer Documentation Portal.