Skip to content

Commit 4d77e96

Browse files
author
Roberto De Ioris
committed
2 parents c0087d6 + e700c8a commit 4d77e96

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

PythonConsole.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,27 @@ unreal_engine.editor_deselect_actors()
2626

2727
# select an actor
2828
unreal_engine.editor_select_actor(an_actor)
29+
30+
# import an asset
31+
new_asset = unreal_engine.import_asset(filename, package[, factory_class])
32+
```
33+
34+
Asset importing
35+
---------------
36+
37+
The following code shows how to import an asset from python (an image as a texture):
38+
39+
```py
40+
import unreal_engine as ue
41+
42+
# get a factory class
43+
factory = ue.find_class('TextureFactory')
44+
45+
# import the asset using the specified class
46+
new_asset = ue.import_asset('C:/Users/Tester/Desktop/logo.png', '/Game/Content/Foo', factory)
47+
48+
# print the asset class (it will be a Texture2D)
49+
ue.log(new_asset.get_class().get_name())
2950
```
51+
52+
The last argument (the factory class) can be omitted, in such a case the factory will be detected by the file extension.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,4 +738,4 @@ Investigate what to do with threads (maybe disallowing unreal engine calls in py
738738
Contacts
739739
--------
740740
741-
If you want to contact us, drop a mail to info at 20tab.com
741+
If you want to contact us, drop a mail to info at 20tab.com or follow @unbit on twitter

0 commit comments

Comments
 (0)