Is there a way to create and use an “external assets” file with Unity? Let’s say for example, I want to create a car racing game and be able to sell additional cars or tracks that the user can just add to the game later. I looked at some of the file i/o scripts, but rather than “re-inventing the wheel” and having to create my own data file type, it would be much easier to be able to just save a dataset (meshes, textures, scripts, etc) into something like Unity’s “package” file to be opened by the stand alone player. Any way to do this?
I don; really know the answer to your question, but I do have an idea/cheat that will achieve what you want.
Have each feature/track/ect… built into the game, and have the user buy them online, in which they recieve an access code that will give them the ability to use whatever they have bought.
Hmmm… Not sure that I’m following you. Are you suggesting that instead of selling separate content, that I sell “access codes” to unlock content that’s already in the game? That would work, but that’s not what I want to do.
What I’d like to do is have some way of updating and adding to whatever the game’s content is when it’s delivered. Ideally, this content file format should be encrypted and packed in a similar manner to how Unity does it. Another way (don’t know if this is possible) is to allow a stand alone player read Unity “packages”.
What I’m trying to avoid is having to create a file format that includes all this data as well as the plugins and scripts that would be required to read them.
Hmmm… Sounds like it might work, but wouldn’t the user have to be on line every time they run the game? This might work for some situations, like the first time they run the game with the new assets. But what about after that? Would it be possible to make the assets local so they wouldn’t have to long onto the internet again?
So relevant to BigK’s question, How about having a folder next to assets and library, called texture2d. How would we reference the ingame filepath to this folder and apply it to a cube/plane etc? Im sure its similar to theWWW version, but different enough to warrant asking this question…
Would it be the same for a mesh?
And how would we do this in a webplayer situation?
The Unity Web Player uses the browser’s download mechanism, and therefore it’s caching mechanism. Of course what exactly happens will depend on the web server setup, and the users settings. For example, it seems some browsers will not cache files above a certain size.
fantastic! I keep being impressed by unity’s workflow… and ease of use theres just nothing like it. I feel like everyday Im free from stupid shackles that I thought are nessercery (in reference to namespaces)
It would be ideal to allow you to download an external web player file and somehow copy/clone assets from that scene/file into the current one (like an additional race car, a custom track, new weapons in a D&D RPG type game, etc.). But as of today I don’t know that you can do such a thing piece-by-piece, you can only load and navigate to an entire file (as per the notes above). This would be a HUGE help for folks posting web games as the core game file could be kept very small and then additional assets could be downloaded on an as-needed basis.
So the beginnings of a solution are there, but still requires someone to “re-invent the wheel”, a lot of work to do what the Unity editor is already doing…
There you go, thanks David. I learn something new every day… I think this kind of functionality is key, especially for web based games where you might want to control which assets are included in an initial download and which are retrieved as needed. Time to go read up on that article link…
Edit: This post contained a non-working suggestion on how to load assets using LoadUnityWeb in combination with DontDestroyOnLoad. I assumed that LoadUnityWeb loaded scenes. In fact it replaces the currently running game wholesale.
I have removed it in order not to cause more confusion.
Ah-ha! Now we’re getting somewhere. This is more like what I was hoping for.
Two questions:
How many times can I load scenes into Unity without destroying scenes? For example: Could I load a base scene, then open a car01 scene, car02, scene, track01 scene, etc.? If so, this is almost exactly what I’m after…
How can I get this to work -without- doing it through the web? Running it through the web the first time might be OK, but after that I’d like to be able to run it locally? Please, please tell me there’s a way to make this work!