Adding Custom Data to AssetBundle

Hey!
So I’m trying to find a way to allow users to create custom content for my game, using Unity as the editor for this content. So far, it works pretty well, using AssetBundles.
Now I want certain gameObjects in the level to be have data on it. No script, only data. For example, I would want a cube to have a “score” value.
I can’t add a MonoBehaviour to it, because then my game won’t load the bundle, since you can’t have scripts in there.
I tried serializing the data into a json file, but then it looks like I can’t include the TextAsset in the same AssetBundle as my level, I get the following error:
“Cannot mark assets and scenes in one AssetBundle. AssetBundle name is “samplescene”.”

So now I’m a bit stuck. Any ideas on how I can move forward? Thanks!

This only means you can have an asset bundle without scenes, or if you put even ONE scene into an asset bundle, you cannot have anything scenes in that asset bundle.

You can certainly mark pretty much any asset for inclusion in an AssetBundle, but you would need code to load it and insert it wherever you need. There’s some tutorials about it.

Here is a relevant post:

https://discussions.unity.com/t/717657

Thanks Kurt, but that’s the thing, I’d like these to be in a single assetbundle, so that users don’t have to load multiple files. I worked ym way around it by including a script in the AssetBundle…I don’t like it, but whatchya gonna do!

What kind of a script? You mean like a LUA script or something interpreted?

Actual C# code will not go in an asset bundle. I mean it might physically go IN the bundle the way a text file does, but there is no compiler present that will compile it into executable code.

Interestingly enough, it is a C# script and it works fine, as long as compiler versions are the same. Also, It’s only data, so a list of public variables that the main game reads in… Not gorgeous, but it works fnie.
Here’s a video of it!
Actually, I’m wondering if ECS would’ve been a good choice here, because that’s essentially what the main game is doing, just not very efficiently