What I want is that when GoblinTransformUpdate runs, it copies the transform from GoblinTransformNode to GoblinTransform… permanently? So that a release build will still use that transform instead of the default?
If it’s just for that one instance - add a “actor->Modify()” before changing it.
If you want to change the actual Object:
You can enumerate through the classes BP nodes to find the component you want to change (assuming you’re class is based on a class supporting it).
Here’s some code that finds the component you’re looking for: (bp is your loaded class, something like UBlueprint* bp=FindObject(package,*name,true); for loading or a reference to your object there in the code cast to UBlueprint)
FCompilerResultsLog resultsLog;
AActor* bpActor=(AActor*)bp->GeneratedClass->GetDefaultObject();
UBlueprintGeneratedClass* bpClass=Cast<UBlueprintGeneratedClass>(bp->GeneratedClass);
USCS_Node* smcNode=nullptr;
UStaticMeshComponent* smc=nullptr;
// Find the first Scene Component (here, change it to search your specific object)
if(USimpleConstructionScript* sConScript=bpClass->SimpleConstructionScript) {
for(USCS_Node* node:sConScript->GetAllNodes()) {
if(auto comp=Cast<USceneComponent>(node->ComponentTemplate)) {
smcNode=node;
smc=comp;
break;
}
}
}
if(smc) {
smc->SetRelativeTransform(transform);
FKismetEditorUtilities::CompileBlueprint(bp,EBlueprintCompileOptions::None,&resultsLog);
FAssetRegistryModule::AssetCreated(bp);
}