Using Asset Data

To use an existing asset database, simply look for its file by "Assets/Scripts/SS3D/Data/Generated", find the database you want to use and then call the item you want to grab.

Examples

Some of these examples have implicit operators to cast them into the correct type. You have to manually add the implicit operators, for now.

Setting an icon for an interaction:

// The Icon field is a Sprite field.
// The InteractionIcons.Open is not a Sprite, it is an AssetDatabase.
// There are implicit operators to cast this AssetDatabase into a Sprite.
public override Sprite GetIcon(InteractionEvent interactionEvent)
{
    return Icon != null ? Icon : InteractionIcons.Open;
}

Setting up tests:

// Get local player position, 
// interaction controller and put bikehorn in first hand available.

// Note that we are adding a PDA manually for the test.
AttachedContainer hand = 
    TestHelpers.LocalPlayerSpawnItemInFirstHandAvailable(Items.PDA);

Creating a world space loading bar

// Calling the New() method simply creates an instance for that object.
_loadingBarInstance = WorldSpaceUI.LoadingBar.New();

Last updated