[Full Release] Introducing CreateDataModelContent: Convert editable mesh and image data into static content

There are two caches used for DataModelContent - there is a cache on the server, and one on the client.

When the server completely deletes every Content that references a certain DataModelContent, that DataModelContent will be deleted from the server, and the budget will be freed up.

At that point, you might still be using that DataModelContent on a client. That’s fine, and will continue to work on the client. You’ll be taking up some room in the client’s cache. Once all Content references on the client that point to that DataModelContent are removed, the DataModelContent will be removed from the client.

2 Likes


when will meshpart texture content get support

Hello, AssetService::CreateDataModelContentAsync supports contents from EditableMesh and EditableImage as input. So, if your meshPart’s TextureContent is an EditableImage, you should be able to pass in that textureContent directly. Were you trying to pass in a different type of TextureContent other than an EditableImage? If so, can you share a bit more about your specific use case?

This is the code snippet i was using when i got the error

local texture = data.Part.TextureContent
local editableImage = texture.Object :: EditableImage

local _, dataModelContent = AssetService:CreateDataModelContentAsync(texture)
if editableImage then editableImage:Destroy() end
				
if dataModelContent then
	data.Part.TextureContent = dataModelContent
end

my script creates a normal editable image and at the end of the loop and it creates it into a datamodel content, and when the function gets called again the editable image gets created from the datamodel content and thats when it errors. Basicially:

editable image → datamodel → texture content :white_check_mark:
editable image → datamodel → texture content → editable image → datamodel → texture content :cross_mark:

im bad at explaining things, but hopefully that makes some type of sense


if you want i can dm a rep file of what i have

Hello! From a quick look at your snippet, it seems you are calling AssetService:CreateDataModelContentAsync(texture), where texture comes from data.Part.TextureContent. Just to clarify—is data.Part.TextureContent definitely an EditableImage at that exact point in the script?
A repro file would be great!

im like 80% sure, i could always be wrong though (which i hope im not because then ill just look stupid :sob:)

wait, i messed the rep up, let me update it

DatamodelRep2.rbxl (65.6 KB)

wait im really confused, this error keeps flipping

plane.TextureContent = AssetService:CreateEditableImageAsync(plane.TextureContent)
--> Unable to assign property TextureContent. Content expected, got Object
plane.TextureContent = AssetService:CreateEditableImageAsync(Content.fromObject(plane.TextureContent))
--> Workspace.Example:58: invalid argument #1 to 'fromObject' (Object expected, got Content)

Hello, thanks for rblx! I notice that in the line above local texture = plane.TextureContent, plane.TextureContent is assigned to imageContent, and the imageContent is a dataModelContent. Feel free to add print(texture) and print(editableImage) after line 59 to check their types and values. To create an EditableImage from DataModelContent, you can call local ei = AssetService:CreateEditableImageAsync(texture). Let me know if this helps or if you have any other questions!

omg i am so sorry, my brain is like melted right now, and that was prob the worst repo file ever made throughout history, sorry for all that :sob:

also i got a question, will we ever be able to use DataModelContent with CreateSurfaceAppearance? Currently that requires the texture maps to be a editable image but it would be extremely helpful if we were allowed to use DataModelContent with it since were pretty limited on live budget

We’ve had several devs request that, and we understand that it’s a valuable use case.

There are some performance issues with packing together a SurfaceAppearance at runtime, and we’re still investigating how to work around those

2 Likes

I’ll bring this up with the team. Just to clarify, by “live budget,” do you mean the budget limits on EditableImages?

1 Like

yeah, live budget as in the normal memory limit for editable images and unfixed editable meshes
when i say live i mean it as in being able to actively modify it

1 Like

Hey, how soon can we expect this to come out of studio beta?

Little late, but there’s a work around for this. I simply only generate things that the player currently sees in the scrollcontainer instead of keeping all children loaded. You have to implement manual positioning, but it works great. I can potentially have hundreds of thousands of items in a container with tiny ram usage (only from how you store the data and the instances you need to fill the view), because I create instances for only what is visible.

1 Like

We are excited to announce that CreateDataModelContent is now available in published experiences. With this API you can now “bake” editable mesh and image data into static Content for the lifetime of the session when you no longer need to edit them.

Please continue providing bug reports, feedback and sharing what you have made in this dev forum post.

4 Likes

Thanks! This works like a charm. Extremely happy this is out now!

Just wanted to let you know that the title for this thread still says [Studio Beta] :wink:

1 Like