Skip to content

Instantly share code, notes, and snippets.

@yujuiting
yujuiting / machine.js
Created September 11, 2019 03:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@yujuiting
yujuiting / dynamic-load-uasset.cpp
Last active January 4, 2024 07:20
Unreal Engine 4: Dynamic load uasset
/*
load uasset from file path.
*/
FString filepath("/Game/an_animation_file"); // without extension, path start with `/Game`, `/Game` refer-> `Content` folder in real.
FStringAssetReference asset_stream_ref(filepath);
TAssetPtr<UAnimationAsset> animation_asset(asset_stream_ref);
UAnimationAsset* animation = animation_asset.LoadSynchronous();
bool isValid = animation_asset.IsValid();
bool isNull = animation_asset.IsNull();
bool isPending = animation_asset.IsPending();

如何在Angular動態載入、建立Component

從最末端開始往回講。

ViewContainerRef#createComponent

createComponent<C>(componentFactory: ComponentFactory<C>,
                   index?: number,
                   injector?: Injector,