<br>您好,还是Jira UE-257047那个问题。在WorldPartition地图中编辑LevelInstance退出后LevelInstance的actor不一定会被重新刷新到WP的问题。
我研究发现,出现此问题的大体原因还是WorldParititon中的ActorDesc合集没有正确刷新。
因为我方工程进度较紧急,所以我实现了一个临时的解决方案。经测试似乎有效。
请协助评估一下此方法是否可行。
具体操作是在ULevelInstanceSubsystem::CommitLevelInstanceInternal函数的最后方,强制清空WP数据,并重新初始化WP。代码如下:
UWorld* world = GetWorld();
if(world)
{
auto *wp=world->GetWorldPartition();
if(wp)
{
const FTransform \&wp\_transfom\=wp\-\>GetInstanceTransform();
wp\-\>Uninitialize();
wp\-\>Empty();
FWorldPartitionHelpers::DoCollectGarbage();
wp\-\>Initialize(world,wp\_transfom);
}
}