요약
메서드
상속된 멤버
API 참조
속성
메서드
ComposeDecalAsync
반환
()
코드 샘플
local AssetService = game:GetService("AssetService")
-- 두 개의 데칼 인스턴스를 생성합니다
local decalA = Instance.new("Decal")
local decalB = Instance.new("Decal")
-- 복합 정보 테이블을 만듭니다
local compositeInfo = {
{
ColorMap = decalA.ColorMapContent,
RoughnessMap = decalA.RoughnessMapContent,
MetalnessMap = decalA.MetalnessMapContent,
NormalMap = decalA.NormalMapContent,
},
{
ColorMap = Content.fromAssetId(123456),
RoughnessMap = decalB.RoughnessMapContent,
MetalnessMap = decalB.MetalnessMapContent,
NormalMap = decalB.NormalMapContent,
}
}
-- 조합할 데칼을 생성합니다
local compositeDecal = Instance.new("Decal")
-- AssetService를 사용하여 기존 데칼을 조합합니다
local success, errorMessage = pcall(function()
AssetService:ComposeDecalAsync(compositeDecal, compositeInfo)
end)
if success then
print("데칼 조합이 성공적으로 완료되었습니다!")
-- 데칼을 표시/사용하는 로직이 여기에 들어갑니다
else
warn("데칼 조합에 실패했습니다:", errorMessage)
endCreateAssetAsync
AssetService:CreateAssetAsync(
매개 변수
| 기본값: "nil" |
반환
코드 샘플
자산 서비스:CreateAssetAsync
local AssetService = game:GetService("AssetService")
local editableMesh = AssetService:CreateEditableMesh()
-- 메시에 정점, 면 및 UV를 추가합니다.
local requestParameters = {
CreatorId = 123,
CreatorType = Enum.AssetCreatorType.User,
Name = "내 자산",
Description = "좋은 자산",
}
local ok, result, idOrUploadErr = pcall(function()
return AssetService:CreateAssetAsync(editableMesh, Enum.AssetType.Mesh, requestParameters)
end)
if not ok then
warn(`CreateAssetAsync 호출 중 오류: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`성공, 새 자산 ID: {idOrUploadErr}`)
else
warn(`CreateAssetAsync에서 업로드 오류: {result}, {idOrUploadErr}`)
endCreateAssetVersionAsync
AssetService:CreateAssetVersionAsync(
매개 변수
| 기본값: "nil" |
반환
코드 샘플
자산 서비스:새 자산 버전 생성 비동기
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(`CreateAssetVersionAsync 호출 중 오류 발생: {result}`)
elseif result == Enum.CreateAssetResult.Success then
print(`성공, 새로운 자산 버전: {versionOrUploadErr}`)
else
warn(`CreateAssetVersionAsync에서 업로드 오류: {result}, {versionOrUploadErr}`)
endCreateDataModelContentAsync
매개 변수
반환
CreateEditableImage
매개 변수
CreateEditableImageAsync
AssetService:CreateEditableImageAsync(
매개 변수
CreateEditableMesh
매개 변수
CreateEditableMeshAsync
매개 변수
CreateMeshPartAsync
매개 변수
| 기본값: "nil" |
반환
CreatePlaceAsync
CreatePlaceInPlayerInventoryAsync
CreateSurfaceAppearanceAsync
매개 변수
코드 샘플
자산 서비스:CreateSurfaceAppearanceAsync
local AssetService = game:GetService("AssetService")
local Workspace = game:GetService("Workspace")
-- 빨간색
local colorEditableImage = AssetService:CreateEditableImage({ Size = Vector2.new(4, 4) })
colorEditableImage:DrawRectangle(Vector2.zero, colorEditableImage.Size, Color3.fromRGB(255, 0, 0), 0, Enum.ImageCombineType.Overwrite)
-- 금속성 (빨간 채널만 보기)
local metalnessEditableImage = AssetService:CreateEditableImage({ Size = Vector2.new(1, 1) })
metalnessEditableImage:DrawRectangle(Vector2.zero, metalnessEditableImage.Size, Color3.new(1, 0, 0), 0, Enum.ImageCombineType.Overwrite)
-- 거칠기 (빨간 채널만 보기)
local roughnessEditableImage = AssetService:CreateEditableImage({ Size = Vector2.new(1, 1) })
roughnessEditableImage:DrawRectangle(Vector2.zero, roughnessEditableImage.Size, Color3.new(0.2, 0, 0), 0, Enum.ImageCombineType.Overwrite)
local surfaceAppearance = AssetService:CreateSurfaceAppearanceAsync({
ColorMap = Content.fromObject(colorEditableImage),
MetalnessMap = Content.fromObject(metalnessEditableImage),
RoughnessMap = Content.fromObject(roughnessEditableImage)
})
local meshPart = Instance.new("MeshPart")
meshPart.Parent = Workspace
-- 메쉬 부분에 서피스 외관 적용
surfaceAppearance.Parent = meshPartGetAssetIdsForPackage
GetAssetIdsForPackageAsync
GetAudioMetadataAsync
매개 변수
반환
코드 샘플
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, "에 의해", result[i].Artist)
else
warn("요청된 자산 #" .. tostring(i) .. "에 대한 메타데이터를 가져올 수 없습니다.")
end
end
endGetBundleDetailsAsync
매개 변수
코드 샘플
번들 세부 정보 가져오기
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"] = "연도는 5003입니다. Battlebot 5000은 그의 가장 강력한 적과 싸우거나 구식이 되는 것을 피해야 합니다.",
["Id"] = 14,
["Items"] = {
[1] = {...},
[2] = {
["Id"] = 1678225030,
["Name"] = "SinisterBot 5001 왼쪽 팔",
["Type"] = "자산"
},
[3] = {...},
[4] = {...},
[5] = {...},
[6] = {...},
[7] = {...}
},
["Name"] = "SinisterBot 5001"
}
--]]
endGetCreatorAssetID
GetGamePlacesAsync
반환
코드 샘플
자산 서비스:GetGamePlacesAsync
local AssetService = game:GetService("AssetService")
local placePages = AssetService:GetGamePlacesAsync()
while true do
for _, place in placePages:GetCurrentPage() do
print("이름:", place.Name)
print("장소 ID:", place.PlaceId)
end
if placePages.IsFinished then
break
end
placePages:AdvanceToNextPageAsync()
endPromptCreateAssetAsync
AssetService:PromptCreateAssetAsync(
매개 변수
반환
PromptImportAnimationClipFromVideoAsync
SavePlaceAsync
SearchAudio
SearchAudioAsync
매개 변수
코드 샘플
음악 검색 제목 가져오기
local AssetService = game:GetService("AssetService")
local audioSearchParams = Instance.new("AudioSearchParams")
audioSearchParams.SearchKeyword = "행복한"
local success, result = pcall(function()
return AssetService:SearchAudioAsync(audioSearchParams)
end)
if success then
local currentPage = result:GetCurrentPage()
for _, audio in currentPage do
print(audio.Title)
end
else
warn("AssetService 오류: " .. result)
end
--[[ 반환된 데이터 형식
{
"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
}
}
--]]