how to access Resource folder on runtime/build[Solution found]

so currently i ran into a problem with things not being created/loaded because of the possible wrong usage of methods.

at the moment for windows based code i use

string[] folders = Directory.GetDirectories(Application.dataPath + "/" + "Resources/Areas/" + currentArea.areaName);

this is to get all folders in a specific folder.

but for some reason on runtime when building a project it does not load the data? can someone assist me?

[Temporary Solution]

Resources.LoadAll<Area>("Areas/" + tempAreaName).Where(x => x.parentTown != null && x.parentTown.name == tempAreaName);

simply said i want to find a way to count how many of a specific object existed in a folder. but this did not seem to work with Directory due to not having access to resources

If you mean the Assets/Resources folder, you can access it by using Resources.Load(string path).

as @Reeii said, use Resources.Load and don’t forget to actually put the thing into proper folder in Assets

no that wont work to get folders. and also i found a different solution.

I see you have the same problem as me.
For the Editor it’s no problem but when you build it is.

I like to know as well how to get easy all the subfolders in the resource folder. (So no assets just the folder).

Resources IS NOT a folder in build. It’s a resource file and the path you added in the editor will be the index to the file you try to load. There is no command to get all the paths you have in the Resources and you really should use this VERY sparingly (in other words: you should not use it at all, usually).