How to design the directory structure of the project?

I am a complete novice and have looked at several projects. I found that they all have scripts in one folder and materials in another folder. I would like to ask if there is any benefit in doing this?
I personally feel that every time I look at a module, I have to search through several folders . The business logic is in one place, the UI is in another place, and the manager is also in another folder.

I previously divided it by function, for example, for the battle function, all the scripts, materials, and prefabs related to the battle were placed in the battle folder. Is there any disadvantage in this?

11 Likes

What you find convenient to use is the best. If you don’t find it convenient to use, no matter how much others say, it will be useless.

I like to put the contents of the same module, such as pictures, code, and prefabs, in the same directory.

It depends on the project size and whether the project has code specifications. If so, just follow them directly (many people always think their design ideas are right. Multi-person projects always like to show off their skills and have their own independent specifications, which makes the project extremely difficult to maintain. I think unified code specifications are the best)
The project is relatively large, there are many scenarios, and one module has many resources. It is better to divide it by module, of course, there should be less dependency between modules.
The project is relatively small, there are fewer interfaces, and there is no need to divide it into many folders, which is not convenient to find.
In general, do whatever is convenient, and there must be specifications.

The main reason is that I have no project experience. I am afraid that I will use it smoothly now, and then after doing a lot of work, I will suddenly find that it doesn’t work. It will be troublesome to refactor it. :joy:

Putting files of the same type in a folder can concentrate your efforts on solving one type of problem: for example, if there is a code problem, look at the code folder (check js error and handle customer complaints), if there is a picture problem, change the picture folder (change pictures, change skins, iterate pictures), if there is a configuration problem, change the configuration folder (planners change the configuration table). In practice, this may correspond to three types of people: technology, art, and planning. All regulations are to reduce communication costs and speed up teamwork.

If you do it all by yourself, you can do it however you want.

If you don’t have project experience, you generally don’t need to consider this kind of problem. There are main programmers who consider these standard things
. If there is no main programmer, it is generally a very small project
. There is no need to consider this kind of thing. Just do it as conveniently as possible.

In fact, most of the UI is done by programs. Prefabs are placed in one folder, scripts in one folder, and pictures in another folder. Anyone who has used it knows how troublesome it is to assemble or modify the UI.

Batch modifying a certain type of folder resources is something that almost never happens. It will inevitably involve resources in other folders. Anyone who likes to make things difficult for themselves can do this. :+1:t2::+1:t2:

This is good, but it is troublesome when doing subcontracting for large projects.

Are you sure it won’t happen?
The art department gives the pictures in the early stage, and changes the pictures in the later stage. You have to search one folder
at a time. The planner gives the fake configuration in the early stage, and the real configuration in
the later stage. You have to search one folder at a time. The main programmer organizes the code review logic, and you have to search for the code one folder at a time.

If you want to split the package, configure the path mapping. The general logic is that a split resource is in a folder.

Do you never change the node structure when you change the image? Do you not preview and check it in the prefab interface after changing it?

Unless you explain in advance to the art department and planners about the new image that matches the previous node structure, you will basically encounter a situation where the node structure does not match the latest rendering.

There is no need to argue about this kind of thing.
Everyone has their own way of working. Arguing will lead to no results. Everyone will think their way is more efficient.

If you agree with the art department, you don’t need to change it. You should check it no matter what kind of specifications you have.

If you want to check, you have to repeatedly switch folders or repeatedly run previews. This is what I mean.

Image folder, prefab folder, you will have to switch between these two folders many times when you batch modify. Modularization will not encounter this problem.

And the bigger the project, the slower your jump speed. I can only say that you either haven’t tried to build the interface yourself, or the project resources are limited . This structure is basically determined by the main program that does not build the interface . You think it’s good, but the people below are exhausted from building and modifying the UI.

Thank you, now I understand why the folders are divided like this