AssetService

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스

자산 서비스 는 Roblox 웹 API에 자산 관련 쿼리를 처리하는 비복제 서비스입니다.

요약

메서드

속성

메서드

CreateEditableImage

새로운 EditableImage 를 생성합니다. 기본적으로 해상도는 512×512로 설정되지만, 메서드의 옵션 테이블을 사용하여 다른 크기를 지정할 수 있습니다.

장치별 편집 가능한 메모리 예산이 소진되면 생성 실패 및 이 메서드는 nil를 반환합니다.

매개 변수

editableImageOptions: Dictionary

메서드에 대한 제어가 포함된 옵션 테이블:

  • Size – 이미지의 원하는 너비와 높이를 지정하는 Vector2
기본값: ""

반환

CreateEditableMesh

새로운 빈 EditableMesh를 생성합니다.정점, 삼각형 및 그 특성은 동적으로 추가될 수 있습니다.장치별 편집 가능한 메모리 예산이 소진되면 생성이 실패하고 이 메서드는 nil를 반환합니다.

매개 변수

editableMeshOptions: Dictionary

생성된 EditableMesh에 대한 옵션이 포함된 테이블.현재 옵션은 없으며, FixedSize 는 항상 비어있는 편집 가능한 메쉬에 대해 false 이므로 사용할 수 없습니다.

기본값: ""

반환

CreateSurfaceAppearance

매개 변수

content: Dictionary
기본값: ""

반환

CreateAssetAsync

생성

지정된 개체에서 Roblox에 새 자산을 업로드합니다.

현재 이 메서드는 로컬로 로드된 플러그인에서만 사용할 수 있으며 먼저 경고 없이 자산을 업로드할 수 있습니다.

매개 변수

object: Object

자산으로 만들 개체.

기본값: ""
assetType: Enum.AssetType

현재 지원되는 유형은 다음과 같습니다:

기본값: ""
requestParameters: Dictionary

자산 메타데이터가 포함된 옵션 테이블:

  • Name – 문자열로 자산의 이름. 기본값은 [object.Name]입니다.
  • Description – 문자열로 자산의 설명. 기본값은 "Created with AssetService:CreateAssetAsync"입니다.
  • CreatorId – 자산 크리에이터의 ID가 숫자로.플러그인 컨텍스트에 로그인된 Roblox Studio 사용자를 기본값으로 지정합니다.오픈 클라우드 Luau 실행 컨텍스트에 필요합니다.
  • CreatorTypeEnum.AssetCreatorType 자산 크리에이터의 유형을 나타내는 것플러그인 컨텍스트에서 기본값은 Enum.AssetCreatorType.User 입니다.오픈 클라우드 Luau 실행 컨텍스트에 필요합니다.
  • IsPackage – 부울 값, 오직 Enum.AssetType.Model 입력적용됩니다. 기본값은 true 입니다.
기본값: "nil"

반환

성공하면 Enum.CreateAssetResult 및 자산 ID 쌍입니다.

코드 샘플

The following code creates a Mesh asset from an EditableMesh.

AssetService:CreateAssetAsync

local AssetService = game:GetService("AssetService")
local editableMesh = AssetService:CreateEditableMesh()
-- add vertices, faces, and uvs to the mesh
local requestParameters = {
CreatorId = 123,
CreatorType = Enum.AssetCreatorType.User,
Name = "My asset",
Description = "a good asset",
}
local ok, result, idOrUploadErr = pcall(function()
return AssetService:CreateAssetAsync(editableMesh, Enum.AssetType.Mesh, requestParameters)
end)
if not ok then
warn(`error calling CreateAssetAsync: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`success, new asset id: {idOrUploadErr}`)
else
warn(`upload error in CreateAssetAsync: {result}, {idOrUploadErr}`)
end

CreateAssetVersionAsync

생성

지정된 개체에서 기존 자산의 새 버전을 업로드합니다.

현재 이 메서드는 로컬로 로드된 플러그인에서만 사용할 수 있으며 먼저 경고 없이 자산을 업로드할 수 있습니다.

매개 변수

object: Object

자산으로 만들 개체.

기본값: ""
assetType: Enum.AssetType

현재 지원되는 유형은 다음과 같습니다:

기본값: ""
assetId: number

새 버전에 대한 자산의 ID.

기본값: ""
requestParameters: Dictionary

자산 메타데이터가 포함된 옵션 테이블:

  • Name – A string . 자산의 이름. 기본값: object.Name.
  • Description – A string . 자산의 설명. 기본값: "AssetService:CreateAssetAsync로 생성됨".
  • CreatorId – A number .자산 크리에이터ID.기본값: 플러그인 컨텍스트에 로그인된 Roblox Studio 사용자.오픈 클라우드 Luau 실행 컨텍스트에 필요합니다.
  • CreatorType – A Enum.AssetCreatorType . 자산 크리에이터의 유형. 기본값: 플러그인 컨텍스트에서 Enum.AssetCreatorType.User 입니다. 오픈 클라우드 Luau 실행 컨텍스트에 필요합니다.
  • IsPackage – A bool . 오직 Enum.AssetType.Model 입력적용됩니다. 기본값: true.
기본값: "nil"

반환

성공하면 Enum.CreateAssetResult 및 자산 버전 번호 쌍이 됩니다.

코드 샘플

The following code creates a new Model asset version.

AssetService:CreateAssetVersionAsync

local AssetService = game:GetService("AssetService")
local assetIdToUpdate = 321
local model = Instance.new("Model")
local requestParameters = {
CreatorId = 123,
CreatorType = Enum.AssetCreatorType.User,
}
local ok, result, versionOrUploadErr = pcall(function()
return AssetService:CreateAssetVersionAsync(model, Enum.AssetType.Model, assetIdToUpdate, requestParameters)
end)
if not ok then
warn(`error calling CreateAssetVersionAsync: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`success, new asset version: {versionOrUploadErr}`)
else
warn(`upload error in CreateAssetVersionAsync: {result}, {versionOrUploadErr}`)
end

CreateEditableImageAsync

생성

지정된 텍스처로 채워진 새로운 EditableImage 개체를 생성합니다.rbxthumb://와 같은 비자산 텍스처 ID가 지원됩니다.이미지 자산을 사용하는 경우 경험의 크리에이터와 연결되거나 소유해야 하거나 경험 내에 생성되었어야 합니다.장치별 편집 가능한 메모리 예산이 소진되면 생성이 실패하고 이 메서드는 nil를 반환합니다.

이 API를 사용할 때의 특별한 고려 사항은 EditableImage를 참조하십시오.

매개 변수

content: Content

자산 콘텐츠를 외부에 저장하거나 장소 내에 개체로 참조하여 지정된 단일 값 중 하나의 값을 래핑합니다. Reference to asset content stored externally or as an object within the 플레이스, wrapping a single value of one of the supported Enum.ContentSourceType values.

기본값: ""
editableImageOptions: Dictionary

생성된 에 대한 옵션이 포함된 테이블. 현재 크기 조정을 통해 지원되지 않기 때문에 옵션이 없습니다.

기본값: ""

반환

제공된 이미지를 포함하는 새로운 EditableImage.

CreateEditableMeshAsync

생성

기존의 EditableMesh 또는 메시 Content ID에서 새로 생성된 새 EditableMesh 개체를 반환합니다.기본적으로 이 메서드에서 생성된 EditableMesh는 메쉬 데이터를 수정할 수만 있고 추가하거나 제거할 수 없도록 고정된 크기가 됩니다.고정 크기 EditableMesh 는 메모리를 덜 사용하고 가능하면 선호되어야 합니다.

장치별 편집 가능한 메모리 예산이 소진되면 생성이 실패하고 이 메서드는 nil를 반환합니다.

이 API를 사용할 때 특별한 고려 사항을 위해 게시된 경험에 편집 가능한 메시를 활성화권한 섹션의 EditableMesh를 참조하십시오.

매개 변수

content: Content

자산 콘텐츠를 외부에 저장하거나 장소 내에 개체로 참조하여 지정된 단일 값 중 하나의 값을 래핑합니다. Reference to asset content stored externally or as an object within the 플레이스, wrapping a single value of one of the supported Enum.ContentSourceType values.

기본값: ""
editableMeshOptions: Dictionary

메서드에 대한 제어가 포함된 옵션 테이블:

  • FixedSize – A bool .기본값은 true 이며, 반환된 EditableMesh 는 베리스를 추가하거나 제거할 수 없고 값만 수정할 수 있습니다.메쉬 토폴로지를 변경할 수 있는 능력이 필요한 경우 false 에 설정하여 메모리를 더 사용하지만 성능에 영향을 줍니다.
기본값: ""

반환

새로운 EditableMesh 인스턴스.

CreateMeshPartAsync

생성

이 메서드는 지정된 MeshPart , CollisionFidelityFluidFidelity 와 함께 RenderFidelity 및 을 생성합니다.읽기 전용인 MeshPart.MeshId 때문에 이 메서드는 기존의 MeshPart를 복제할 필요 없이 스크립트를 통해 어떤 메쉬 ID로든 메쉬를 생성하기 위한 것입니다.생성이 실패하면 오류를 던집니다.

매개 변수

meshContent: Content

자산 콘텐츠를 외부에 저장하거나 장소 내에 개체로 참조하여 지정된 단일 값 중 하나의 값을 래핑합니다. Reference to asset content stored externally or as an object within the 플레이스, wrapping a single value of one of the supported Enum.ContentSourceType values.

기본값: ""
options: Dictionary

메서드에 대한 하나 이상의 컨트롤이 포함된 옵션 테이블:

  • CollisionFidelity – 결과 부품의 CollisionFidelity 값.옵션이 없거나 표가 없으면 기본값은 입니다.
  • RenderFidelity – 결과 부품의 RenderFidelity 값.옵션이 없거나 표가 없으면 기본값은 입니다.
  • FluidFidelity – 결과 부품의 FluidFidelity 값.옵션이 없거나 표가 없으면 기본값은 입니다.
기본값: "nil"

반환

CreatePlaceAsync

생성

주어진 templatePlaceID를 통해 장소를 복제하고 새로운 플레이스PlaceId를 반환하여 TeleportService로 사용할 수 있습니다.클론 장소는 지정된 이름과 설명으로 플레이스생성자의 인벤토리에 표시됩니다.

템플릿 장소에서 장소 설정을 통해 템플릿 복사가 활성화되어 있어야 합니다. 보유않은 장소를 복제하는 데 이 방법을 사용할 수는 없습니다.

이 API의 자주 사용은 권장되지 않으며, 특히 생성된 장소에 스크립트가 포함되어 있는 경우 대규모 장소의 코드를 신속하게 업데이트하는 것이 불가능해집니다.사용자 생성 세계의 경우, 대신 사용자 생성을 직렬화하고 DataStores에 저장하십시오.

매개 변수

placeName: string

새로운 플레이스이름.

기본값: ""
templatePlaceID: number

PlaceId 클론할 장소.

기본값: ""
description: string

새로운 플레이스설명.

기본값: ""

반환

PlaceId 의 새로운 플레이스.

CreatePlaceInPlayerInventoryAsync

생성

매개 변수

player: Instance
기본값: ""
placeName: string
기본값: ""
templatePlaceID: number
기본값: ""
description: string
기본값: ""

반환

GetAssetIdsForPackage

생성

지정된 패키지에 포함된 자산 ID 배열을 반환합니다.

매개 변수

packageAssetId: number
기본값: ""

반환

지정된 패키지에 포함된 자산 ID.

GetAudioMetadataAsync

생성

특정 오디오 소스(아티스트, 타이틀, 지속 시간, 입력등)에 대한 관련 메타데이터를 제공합니다.

매개 변수

idList: Array

메타데이터를 검색할 자산 또는 콘텐츠 ID 배열. 최대 배치 크기는 30입니다.

기본값: ""

반환

요청과 동일한 순서의 사전 테이블 배열, 각 사전에는 자산/콘텐츠에 대한 다음 메타데이터가 포함됩니다:

  • AssetId (문자열)

  • Title (문자열)

  • Artist (문자열)

  • Duration (번호) 초

  • AudioType ( Enum.AudioSubType )

예를 들어 요청된 자산의 메타데이터 검색 중에 오류가 발생하면 자산 ID가 존재하지 않거나 사전 테이블이 반환된 배열에 포함되지만 참조 목적으로만 AssetId 필드가 포함됩니다.또한, 특정 자산(아마도 비공개 오디오이기 때문일 수 있음)에 대해 AudioType 을 결정할 수 없으면 결과 사전에 AudioType 항목이 포함되지 않습니다.

코드 샘플


local AssetService = game:GetService("AssetService")
local SoundService = game:GetService("SoundService")
local trackIDs = {
SoundService.Sound1.SoundId,
SoundService.Sound2.SoundId,
SoundService.Sound3.SoundId,
SoundService.Sound4.SoundId,
}
local success, result = pcall(function()
return AssetService:GetAudioMetadataAsync(trackIDs)
end)
if success then
for i = 1, #trackIDs do
local contentId = "rbxassetid://" .. result[i].AssetId
if trackIDs[i] == contentId then
print(result[i].Title, "by", result[i].Artist)
else
warn("No metadata fetched for requested asset #" .. tostring(i))
end
end
end

GetBundleDetailsAsync

생성

이 함수는 지정된 번들내용 세부 정보를 반환합니다.

패키지 ID가 존재하지 않으면 HTTP 400 (Bad Request) 를 던집니다. bundleId 가 정수로 변환할 수 없으면 Unable to cast string to int64 를 던집니다.

매개 변수

bundleId: number

지정된 번들ID.

기본값: ""

반환

다음 키-값 쌍을 포함하는 사전에는 지정된 패키지에 대한 세부 정보가 포함되어 있습니다: Dictionary with the following key-value pairs containing details about the specified 번들:

  • Id — 패키지 ID(전달된 bundleId 인수와 동일)

  • Name — 패키지 이름

  • Description — 패키지 설명

  • BundleType — 예를 들어 Enum.BundleType 또는 "BodyParts" 또는 "DynamicHead"를 나타내는 문자열

  • Items — 번들배열, 각각 다음 키를 통해 표시된 세부 정보:

    • Id — 아이템 ID

    • Name — 아이템 이름

    • Type"Asset"와 같은 아이템 유형.

코드 샘플

Getting Bundle Details

local AssetService = game:GetService("AssetService")
local BUNDLE_ID = 14
local success, result = pcall(function()
return AssetService:GetBundleDetailsAsync(BUNDLE_ID)
end)
if success then
print(result)
--[[
{
["BundleType"] = "BodyParts",
["Description"] = "The year is 5003, Battlebot 5000 must face his mightiest foe, or face becoming obsolete.",
["Id"] = 14,
["Items"] = {
[1] = {...},
[2] = {
["Id"] = 1678225030,
["Name"] = "SinisterBot 5001 Left Arm",
["Type"] = "Asset"
},
[3] = {...},
[4] = {...},
[5] = {...},
[6] = {...},
[7] = {...}
},
["Name"] = "SinisterBot 5001"
}
--]]
end

GetGamePlacesAsync

생성

현재 경험 내의 장소 이름과 StandardPages 의 개체를 포함하는 반환 PlaceId 개체를 반환합니다.


반환

코드 샘플

The following code prints the name and PlaceId of each place in the experience.

AssetService:GetGamePlacesAsync

local AssetService = game:GetService("AssetService")
local placePages = AssetService:GetGamePlacesAsync()
while true do
for _, place in placePages:GetCurrentPage() do
print("Name:", place.Name)
print("PlaceId:", place.PlaceId)
end
if placePages.IsFinished then
break
end
placePages:AdvanceToNextPageAsync()
end

PromptCreateAssetAsync

생성

사용자에게 게시 대화 상자를 표시하여 경험 내 자산 생성을 허용합니다.호출되면 사용자에게 대화를 제공하여 이름, 설명 및 자산을 미리 볼 수 있습니다.제출되면 자산이 사용자의 인벤토리에 저장됩니다.서버 측에서만 호출할 수 있습니다.

매개 변수

player: Player

자산 작품제출하는 사용자.

기본값: ""
instance: Instance

만들어질 자산. 현재 스크립트나 비공개 자산을 중첩할 수 없습니다.

기본값: ""
assetType: Enum.AssetType

자산 입력. 현재는 Enum.AssetType.Model만 사용할 수 있습니다.

기본값: ""

반환

성공하면 Enum.PromptCreateAssetResult 및 자산 ID 쌍입니다.

PromptImportAnimationClipFromVideoAsync

생성

매개 변수

player: Player
기본값: ""
progressCallback: function
기본값: ""

반환

SavePlaceAsync

()
생성

현재 플레이스상태를 저장합니다. AssetService:CreatePlaceAsync()로 생성된 장소나 장소 설정을 통해 API가 활성화된 장소에서만 작동합니다.


반환

()

SearchAudio

생성

지정된 검색의 결과를 포함하는 AudioPages 개체를 반환합니다. 빈 값이 있는 필드는 반환하지 않습니다.

이 메서드에는 낮은 HTTP 요청 한도가 있으며 오류를 발생시킬 수 있으므로 항상 오류 처리를 위해 pcall()로 감싸야 합니다.가능한 오류 메시지는 다음을 포함합니다:


<th>이유</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTTP 429(너무 많은 요청)</td>
<td><code>Class.AssetService:SearchAudio()</code>가 너무 많이 호출되었습니다.</td>
</tr>
<tr>
<td>데이터에 예기치 않은 유형, 예상 배열이 null 되었습니다</td>
<td>키워드 인수가 필터링되었습니다.</td>
</tr>
</tbody>
오류 메시지

매개 변수

searchParameters: AudioSearchParams
기본값: ""

반환

코드 샘플

This code gets the music assets returned by the keyword "happy" and prints out their titles.

Getting Music Search Titles

local AssetService = game:GetService("AssetService")
local audioSearchParams = Instance.new("AudioSearchParams")
audioSearchParams.SearchKeyword = "happy"
local success, result = pcall(function()
return AssetService:SearchAudio(audioSearchParams)
end)
if success then
local currentPage = result:GetCurrentPage()
for _, audio in currentPage do
print(audio.Title)
end
else
warn("AssetService error: " .. result)
end
--[[ Returned data format
{
"AudioType": string,
"Artist": string,
"Title": string,
"Tags": {
"string"
},
"Id": number,
"IsEndorsed": boolean,
"Description": string,
"Duration": number,
"CreateTime": string,
"UpdateTime": string,
"Creator": {
"Id": number,
"Name": string,
"Type": number,
"IsVerifiedCreator": boolean
}
}
--]]

이벤트