USelection* SelectedActors = GEditor->GetSelectedActors();
for (int32 ActorIndex = 0; ActorIndex < SelectedActors->Num(); ++ActorIndex)
{
UObject* SelectedActor = SelectedActors->GetSelectedObject(ActorIndex);
AActor* Actor = Cast<AActor>(SelectedActor);
UE_LOG(LogTemp, Warning, TEXT("%s"), *Actor->GetActorLabel());
}
UE4 Editor 获得当前所有选择对象并打印
于 2023-03-07 14:37:48 首次发布
这段代码在UnrealEngine环境中运行,它首先获取当前编辑器中选中的Actor集合,然后遍历这个集合,将每个选中的Actor转换为AActor类型,并打印出它们的标签。这是一个用于调试或编辑器脚本的常见操作。
1251

被折叠的 条评论
为什么被折叠?



