Using Python to create an array

Hi all,

I’m starting to use Python to script inside Unreal Editor.

I’m having a hard time trying to create an array of AssetImportTask.
I need it in a assetTools.import_asset_tasks() function.

Any idea?

Many thanks!

New line was omitted when posting. The code should read:
x = []
x.append(unreal.AssetImportTask())

Thanks .law!

I realise this is old now, but it’s hard to derive the issue you’re facing from this question.
Please describe your issue in more detail.

Python’s built in array objects can be used with unreal types. For example:
x = [] x.append(unreal.AssetImportTask())
gives an array with a single empty AssetImportTask.

Hey
Do you know if there’s a way to get python to create a “list” of a valid unreal type?

so, for example if I’m calling a c++ function: void SomeFunction(TArray<AActor*> Actors)

passing on a python “list” of actors won’t do.

for a single variable it easily sets it of a valid unreal type, but making the equivalent of an array is completely escaping me, as they come out as “lists”, which unreal doesn’t know what to do with.

I’m specifically trying to pass on an array of structs, and short of writing a wrapper function that processes several individual lists and turns them into the proper struct array i don’t know what to do.

Thanks !

in UE4.26 :

LogPython: int_array=unreal.Array(int)

LogPython: int_array.append(1),