![]() As I’m sure you know, a single Game Object can have many components attached to it. One last thing to note is that, unlike Game Objects, each Scriptable Object asset only has a single script attached to it. Another difference is that SOs don’t have a hierarchy and can’t be nested the way Game Objects are. prefab extension) than a Game Object (which only exists within other files). In that way, they’re more similar to a prefab (which is a file with a. Game Objects only exist within Scenes or Prefabs, whereas a Scriptable Object is an asset that exists on disk. A Scriptable Object is similar to a Game Object with an attached MonoBehaviour, but with a couple of differences. To put it briefly, a Scriptable Object (SOs) is an asset on which you can attach a script. Finally, I’ll give an example problem that I solved using Scriptable Objects. Then, I’ll explain what they do exceptionally well and some of the ways I like to use them. First, I’ll explain what Scriptable Objects are. Long story short, I seem to have fixed my problem with loading meshes(Although not elegantly), but now I seem to have another problem which is prefabs containing Particle Effects and Audio will load all the components and particle systems, but the AudioClip variable is "Missing (Audio Clip)", and all the textures and materials used in the particle effect show up pink, with their variables also showing "Missing (Material/Texture)", I'll keep posted as i further investigate possible solutions for that as well.This article covers the basics of Scriptable Objects and some ways in which they’re helpful. This is strange though since textures that appear in "common" are able to be loaded without any problems. What finally got it to work correctly for me is when I took the GameObject - referencing the Mesh- out of the Common AssetBundle and put one in each of the rarity specific AssetBundles (despite it giving me duplicate item warnings in the AssetBundle Manager), it began working as fully intended, leading me to believe that for some reason the dependency wasn't being followed. I have multiple assetbundless for each rarity level ScriptableObject parts i generate, but for all the shared things like textures and Meshes, I have them stored in an AssetBundle called "common". (But also using your suggestion about loading it as a gameobject then extracting the mesh did the trick on top of it all!) ![]() It turns out there is some error going on about how the dependencies are being followed in my assetbundles. When I built the AssetBundles, I did so using the AssetBundle Plugin provided by unity to ensure there were not duplicates or conflicting filesĭoes anyone have any suggestions as to what I can do to try and fix this? My suspicion is this has something to do with a dependency not being correctly which would make sense as the scriptable object itself is able to be loaded as proved by the generator being able to produce the correct Name. However, i am certain that i have my Scriptable Object setup correctly as you can see here: The mesh model does not seem to be loaded correctly: when used in the actual game, the mesh filter which i assign the model to shows "None (Mesh)". When I run this, my output looks as follows: (not to be confused with name, designated to the object name) ![]() The "Name" refers to the display name of the item as the user will see it and is not used in any part of the loading process. In this above image, "input" refers to a JSON container class, where input.model is a string representing the name of the scriptable object instance to load from the AssetBundle. Here is a snippet of code to show where the item is being generated: This has worked so far for Strings, Ints, Textures, and Particle Systems, however I seem to have run into an issue where the mesh associated with the scriptable object is not being loaded. In my effort to create a scriptableObject based procedural generation system, I placed all of my scriptable objects into their own AssetBundles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |