Common Utils plugin for UE
Python like
for (auto i : XRange(1))
{
UE_LOG(LogTemp, Warning, TEXT("Index: %d"), i);
}
for (auto i : XRange(1,100))
{
UE_LOG(LogTemp, Warning, TEXT("Index: %d"), i);
}
for (auto i : XRange(100,1, -2))
{
UE_LOG(LogTemp, Warning, TEXT("Index: %d"), i);
}
TArray<int> Array = {3,2,1};
for (auto Item : XRange(Array))
{
UE_LOG(LogTemp, Warning, TEXT("Index: %d, Value: %d"), Item.Key, Item.Value);
}
Help for reading and writing properties of UObject (Include Blueprint)
auto Actor = NewObject<AActor>();
auto Wrapper = UPUObjectWrapper::Create(Actor, FPropertyFilters::NoFiltering);
// access private member
auto Prop = Wrapper->GetPropertyByName(TEXT("bCanBeDamaged"));
bool bCanBeDamaged = Prop->GetValue<bool>();
Prop->SetValue(!bCanBeDamaged);
ensure(Actor->CanBeDamaged() == !bCanBeDamaged);
Help for reading and writing excel files(.xlsx) in c++ and blueprint, only works on Windows
auto ExcelFile = UExcelFile::CreateExcelFile(TEXT("G:/Test.xlsx"));
auto Sheet = ExcelFile->AddSheet(TEXT("TestSheet"));
ExcelFile->AddRow(Sheet, 1, {TEXT("Col1"), TEXT("Col2")});
ExcelFile->Save();
- Auto add scope timer for every lua function, make lua profiling easier in Insight.
Help to reduce the memory allocation
FFastUObjectPool
, a pool used for UObjectFNormalObjectPool
, a dynamic size pool which can be collected by gc , good for memory usageFFixedObjectPool
, a fixed size pool , cache friendyFFlatObjectPool
, a balance between cache friendly and memory usage
implementation of any in UE
int Num = 1;
FAny Any = Num;
Num = AnyCast<int>(Any) + 1;
Provide a Javascript-like promise, but not strictly follow the Rules of Promise/A+.
auto Promise = FPromise:New()
Promise.Then([](int Num){
// todo
});
Promise.Resolve(1);