Skip to content

Instantly share code, notes, and snippets.

@Gramps
Last active March 30, 2025 18:23
Show Gist options
  • Save Gramps/d00c135c6a1db9318e2e4ab420684756 to your computer and use it in GitHub Desktop.
Save Gramps/d00c135c6a1db9318e2e4ab420684756 to your computer and use it in GitHub Desktop.
Steamworks UGC Image Upload
extends Control
@export var steam_app_id: int = 3013040
func _ready() -> void:
print(Steam.steamInitEx(false, steam_app_id, true))
Steam.item_created.connect(_on_item_created)
Steam.item_updated.connect(_on_item_updated)
func _on_create_pressed() -> void:
Steam.createItem(steam_app_id, Steam.WORKSHOP_FILE_TYPE_ART)
# Steam.createItem(steam_app_id, Steam.WORKSHOP_FILE_TYPE_SCREENSHOT)
func _on_item_created(result: int, file_id: int, need_to_accept_tos: bool) -> void:
if result != Steam.RESULT_OK:
print("Failed to create item for file %s: %s" % [file_id, result])
return
if accept_tos:
print("Need to accept TOS still")
print("Showing UGC EULA: %s" % Steam.showWorkshopEULA())
var handle = Steam.startItemUpdate(steam_app_id, file_id)
print("Item handle: %s" % handle)
print("Set item title: %s" % Steam.setItemTitle(handle, "Skillet Test Screenshot"))
print("Set item description: %s" % Steam.setItemDescription(handle, "Test Description for UGC uploads!"))
print("Set item preview: %s" % Steam.setItemPreview(handle, "/home/gp/Desktop/UGC/fire.png"))
print("Set item content: %s" % Steam.setItemContent(handle, "/home/gp/Desktop/UGC/"))
print("Set item visibility: %s" % Steam.setItemVisibility(handle, Steam.REMOTE_STORAGE_PUBLISHED_VISIBILITY_PUBLIC))
Steam.submitItemUpdate(handle, "Testing UGC screenshot upload")
func _on_item_updated(result: int, need_to_accept_tos: bool) -> void:
if result != Steam.RESULT_OK:
print("Item update failed")
return
if need_to_accept_tos:
print("Need to accept TOS still")
print("Showing UGC EULA: %s" % Steam.showWorkshopEULA())
print("Item updated")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment