Skip to content

RegisterAsset

Aidanamite edited this page Oct 11, 2021 · 2 revisions

Description:

Can be used to register a GameObject prefab or Sprite. You will need to use this to setup an item's image or the behaviour object of an equipment item.

Note: this will not work for Effects, use the RegisterEffect method instead.

Returns: string

The returned string is the asset name that you should use for items or objects that need to use a prefab or sprite.

Arguments:

  • string name This is the name id used for registration of this prefab/sprite. It can be anything you want it but must be different from anything of the same type you've registered. (you can have a prefab and a sprite registed under the same name but not 2 sprites or 2 prefabs)

  • ? obj This is the GameObject or Sprite you want to register to the specified name.

Example:

the CreateSprite method is from the Extension Methods included in AssetsLib

string myItemSprite = AssetLib.AssetLibTools.RegisterAsset<Sprite>("MyItem", myItemImage.CreateSprite());

Clone this wiki locally