#StreamWriter and Better Streaming Assets

1 messages ยท Page 1 of 1 (latest)

shadow cape
#

.

vivid lion
#

What is the stack trace actually pointing to

vivid lion
#

It's an issue with a call to GetFiles

#

you are passing a file path to something that expects a directory

naive basin
#
  1. Use / as path delimiter
  2. Use relative path
shadow cape
#

and what do you mean by use relative path

shadow cape
#

and the string is correct as you saw from the screenshot I sent

vivid lion
#

"Get the files in this directory" and then you pass it a file

shadow cape
#

ok so you are saying that it's better assets causing the error and not the stream writer.
let me try to get all files and filter them by name then and see if the error is still there

naive basin
#

GetFiles searches the directory and give you list of files

#

And you should not use stream writer to StreamingAssets. It's read only on the build.

#

So I think your usage itself is wrong ๐Ÿค” Use persistentDataPath to save data

shadow cape
#

from what I've read the only persistent data paths are streaming assets and resources and in this case resources are not an option for me

shadow cape
#

meen I've been asking about this for ages and everybody told me that the only persistent things were asset bundles resources and streaming assets 0_o

#

thanks a ton for this and let me give it a try

naive basin
shadow cape
naive basin
shadow cape
# naive basin Any files

well my question was:
I would like to allow users to create custom maps for my games with scripts(which I can see why they wouldn't work without being built in the game), scenes, materials...

#

for this game I need only text files since I am building my own level editor

naive basin
shadow cape
#

I see

naive basin
shadow cape
naive basin
#

CreateDirectory ๐Ÿ˜‡

shadow cape
#

yeah but how, in the streaming assets it was a simple as creating a folder there

naive basin
#

Do Directory.CreateDirectory

shadow cape
#

ok I guess I'll need a script for creating a new level then but that's not a problem, let me try to work this out and thanks a ton you saved me a lot of time

#

actually wait, is there a way to create this directory when the game is being installed or ran for the first time so I don't have to check if the directory exists every time I am running the game?

#

I am aware that I can make a custom installer but that wouldn't work for android and this game is mainly targeted for phone users

naive basin
#

Creates all directories and subdirectories in the specified path unless they already exist.

shadow cape
#

yeah I will find out how to use that method what I asked is if it was possible to do something on the first game run only or something like that but it's ok if you don't have time figuring that out for me

winged breach
#

lol

naive basin
#

Read what I quote? Creates unless they already exist.

shadow cape
#

but as I said it's all good and you don't have to help me with that I am already thankful enough for this because it saved this and one more project I was working on so thanks for that

naive basin
#

Add flag to PlayerPrefs if it's first run. But then that is already checking something anyways.
There is no built-in isFirstRun or whatever and if such thing exists it is checking something too.
No difference than check if directory exists.

shadow cape
#

ok I see, thanks!

naive basin
#

Alright good luck with your project