| 655 | } |
| 656 | |
| 657 | void GameCookerImpl::OnCollectAssets(HashSet<Guid>& assets) |
| 658 | { |
| 659 | PROFILE_MEM(Editor); |
| 660 | if (Internal_OnCollectAssets == nullptr) |
| 661 | { |
| 662 | auto c = GameCooker::GetStaticClass(); |
| 663 | if (c) |
| 664 | Internal_OnCollectAssets = c->GetMethod("Internal_OnCollectAssets", 0); |
| 665 | ASSERT(GameCookerImpl::Internal_OnCollectAssets); |
| 666 | } |
| 667 | |
| 668 | MCore::Thread::Attach(); |
| 669 | MObject* exception = nullptr; |
| 670 | auto list = (MArray*)Internal_OnCollectAssets->Invoke(nullptr, nullptr, &exception); |
| 671 | if (exception) |
| 672 | { |
| 673 | MException ex(exception); |
| 674 | ex.Log(LogType::Error, TEXT("OnCollectAssets")); |
| 675 | } |
| 676 | |
| 677 | if (list) |
| 678 | { |
| 679 | auto ids = MUtils::ToSpan<Guid>(list); |
| 680 | for (int32 i = 0; i < ids.Length(); i++) |
| 681 | assets.Add(ids[i]); |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | bool GameCookerImpl::Build() |
| 686 | { |