Use assets

Beginner There are three ways to use assets:

  • -

    Reference assets in components

    Many kinds of component use assets. For example, model components use model assets. asset docks in the property grid. property grid). You can drop assets in the text field or the empty thumbnail. (Select an asset). Select an asset window opens.
    Note
    Select an asset window only displays assets of types expected by the component. For example, if the component is an audio listener, the window only displays audio assets. After you add an asset to a component, the asset dock displays its name and a thumbnail image.

    Reference assets in other assets

    Assets can reference other assets. For example, a model asset might use material assets. You can add asset references to assets the same way you add them to entity components (see above).

    Clear a reference

    asset dock, click (Clear reference).

    Examine references

    References tab. By default, this is in the bottom right of Game Studio.
  • References tab displays the assets referenced by the selected asset.
  • Referenced by tab displays the assets that reference the selected asset.
    Tip
    View > References.

    Load assets from code

    You can load assets at runtime and use them in your scripts.
    1. // Load a model (replace URL with valid URL)var model = Content.Load<Model>("AssetFolder/MyModel");// Create a new entity to add to the sceneEntity entity = new Entity(position, "Entity Added by Script") { new ModelComponent { Model = model } };// Add a new entity to the sceneSceneSystem.SceneInstance.RootScene.Entities.Add(entity);
    Tip
    AssetFolder/AssetName.
    Warning
    When loading assets from scripts, make sure you:
  • Manage assets -

    Unload unneeded assets

    When loading assets from code, you should unload assets when you don’t need them any more. If you don’t, assets stay in memory, wasting GPU. Content.Unload(myAsset).

    See also

  • Create assets
  • Manage assets