Show / Hide Table of Contents

Class AssetTool

Inheritance
System.Object
AssetTool
Namespace: BlueprintCore.Utils.Assets
Assembly: BlueprintCore.dll
Syntax
public class AssetTool

Methods

| Improve this Doc View Source

RegisterDynamicPrefabLink(String, AssetLink<PrefabLink>, Action<GameObject>)

Registers assetId as an asset. When the asset is requested for load, source is loaded and copied, init is called on the copy, and the copy is returned.

Declaration
public static void RegisterDynamicPrefabLink(string assetId, AssetLink<PrefabLink> source, Action<GameObject> init)
Parameters
Type Name Description
System.String assetId

Unique identifier used to load the asset

AssetLink<Kingmaker.ResourceLinks.PrefabLink> source

The base game prefab copied to create your prefab.

System.Action<UnityEngine.GameObject> init

Function called passing in a copy of the source prefab. Use this to configure your prefab.

Remarks

Use this to create a new asset based on a base game asset dynamically. You configure the GameObject in init and it will be used whenever an asset with assetId is requested.

var assetId = "0a2f44a9-0650-452f-8ff6-24fd4e61c7ef"; // New GUID identifying your prefab
var sourceAssetId = "fd21d914e9f6f5e4faa77365549ad0a7"; // A 20-ft ground ice effect from the base game

// When assetId is requested: load sourceAssetId, copy it, then set its scale to 50% RegisterDynamicPrefabLink(assetId, sourceAssetId, prefab => prefab.transform.localScale = new(0.5f, 0.5f));

// Creates an AOE using the new asset AbilityAreaEffectConfigurator.New(AreaEffectName, AreaEffectGuid).SetFx(assetId).Configure();

Exceptions
Type Condition
System.ArgumentException

If assetId is already in use

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX