Create file in "_Data" folder / Preserve file from Assets folder, during build ?

Hi there!

When building a project, unity creates a _Data folder.

Is it possible to have unity MOVE files from the Assets folder to this _Data folder, during build?

I have two files, which I need POST-build:

1: A simple .txt file with a url to a server inside.
2: A customisable gamedata file, which i can edit to tweak the gameplay.

At the moment i manually copy / paste them after building, which is kind of lame :confused:

The problem is, that I want to be able to edit the two files AFTER build, so during a build, i just want unity to copy those two files into the _Data folder, instead of whatever it is actually doing :face_with_spiral_eyes:

I cant be the first person with this kind of problem.

Yes, it’s simple. We do this for our project as it uses custom level files instead of Unity scenes.

Nice to hear there is a solution, but could you give me abit more information?
I dont quite see how the BuildPlayer can do this.

Somehow, I just knew there would be a “can you…you know…point me in the right direction?”

This is the part where I explain that you should read a little bit about copying files about in C#.

That is your cue to just ask somebody to show you “an example” which conveniently does exactly what you need.

I am not looking to be guided step by step, i was just hoping that somewhere in the huge unity API, there was a neat little feature to actually do this, without having to code it all “from scratch”

From your first post, the only “direction” you actually gave me, was to create a whole new “build settings”-dialog.
I could do that, sure, but thats just a waste of time and not really what im looking for…

I’ll stick to copy / pasting manually, as the feature does not seem to exist…

Thanks !!

sigh…just…sigh

Please… Correct me if im wrong, or are you just on the forums to be a big shot?
What a waste of time, christ…

What part of “We do this for our project as it uses custom level files” did you not get? It’s the same thing as you are doing. I even told how we do it. Implement it in a way which complies with your requirements and you are set.

I get it.

Yeap… Great !

Nope.

Implement what… You linked a… “…function to programatically create a build of your project.”

With this function, I can set the scenes, a path, build target and build options.
Uhm… Yea, as i politely said previously, I dont see how this can solve my problem, without creating a whole new build-settings-dialog, (a dialog to actually set a build-destination, select which scenes to include, and so on).

But this is the only thing you’ve actually shown me so far, after 5 posts…

OK, since you really do just want to be shown how to do it rather than pointed in the right direction.

Simple. Week one programming.

As I said…

Guy please… Don’t patronize me, and dont call it the “right direction”, when ive said multiple times that i dont want to recreate the whole build-dialog…

You have hardcoded parameters… No thanks…
If you use the build-in “build-settings”-dialog, it wont work (aka. you remade the whole build-functionality).

So get off your high horse… If you had just shown me what you actually ment ealier, I could have said “meh…” and moved on…

Thanks for your “effort” tho’… gl hf…

You could actually write a dialogue if you were so inclined, I just needed a nice simple thing for my purposes.

Anyway, make yourself a dialogue to do what you need to do, I seriously doubt you can do it though.