Organization of the "Unity" 2.3 Project Browser and resources

Source: Internet
Author: User

Categories: Unity, C #, VS2015

Date Created: 2016-03-29 First, project-Engineering browser

As we said earlier, project View in unity, called the Engineering Browser, is equivalent to Solution Explorer (solution) in VS2015, where unity can contain multiple levels (*.unity) per project, each of which is a project that can be run independently. Depending on the target platform being published, the extension of the executable program generated after compilation is also different, for example, the executable program generated by the Windows platform is (. exe file), For a browser (WEB) that is running under the Windows platform, a dynamic-link library (. dll file) is generated for the Android platform (. apk file). While VS2015 is a Solution Explorer (solution) that can contain multiple projects (project), on the Windows platform, each project differs depending on the template that is created, and the files that are generated after compilation are different, or that It is possible to build a program (. exe file) that can be executed independently, or a dynamic-link library (. dll file) that can be called by another program.

In short, although English is called Project, but the meaning is different. To be easy to differentiate, in Chinese translation, Unity's project is generally referred to as engineering, and project solution under VS2015 is referred to as projects.

The various resources and scripts under project in Unity are categorized by folders, so it's called the Project browser. The resources and source programs under these folders are equivalent to the various resources and source programs under each project (English and Project) in VS2015 Solution Explorer (solution), except that VS2015 is first differentiated by project category. They are then categorized by folders and namespaces under the project, not just folders.

This is to understand the concept of unity and VS2015:

Unity VS2015

Name Poject (Engineering) Solution Explorer (. sln)

folder under Project Poject under projects in the folder Solution Explorer

Use management various resources and scripts to manage various resources and source programs

File management level file (*.unity) project file (. csproj)

Resource Assets Resources

Logical control script (. cs file) source program (. cs file)

The best way to understand these meanings is to open the sample project that comes with unity when you install it, and then look at the corresponding view and the folders and files under the view.

Is the project view after you open the sample project that comes with unity when you install it:

Project view displays the structure of the project in the form of a ListView. When you click a folder in the list, the content is immediately displayed in the right view. A single resource is displayed as an icon and its type is indicated (script, material, subfolder, and so on). Move the slider below the view to adjust the icon size. If the slider moves to the far left, it is replaced by another view of the ListView.

The top of the ListView that represents the engineering structure is the Favorites (Favorites) section, which is used to save frequently used items for easy access later.

You can bookmark items in the project structure list by dragging them directly into the Favorites folder (Favorites).

The drop-down boxes below project are used to create various resources that are functionally the same as the Create submenu under the main menu assets to add new resources and subfolders to an existing folder.

The Window menu has an option to convert to a single-column version of the drawing view, with a single-column view that basically has a hierarchical list and no icon views. The lock icon next to the menu can freeze the current content in the freeze view (such as preventing events from being changed elsewhere), and its usage is similar to the use of the viewer (Inspector) lock.

1. Common shortcuts

The shortcut is available when the Project browser view has focus. The following are common shortcuts:

CTRL + A selects all visible items in the list

Delete pop-up dialog box after deleting

Shift+delete do not pop up the dialog box and delete directly

Enter to open the selected resource

2. Scene (Scenes)

In general, the scenes subfolder under the Assets folder contains different scene files (*.unity), which contain various game objects that can be used to create a main menu, a separate level, and so on.

Unity sees each unique scene file as a level. In each scene, the environment, obstacles and decorations can be placed.

Create scene: File-->new scene

Save scene: File-->save scene

3. Instantiation Presets (prefabs)

The Prefabs folder is generally used to save various preset files.

Once you create a preset (Prefab), you can easily and quickly create a copy of the preset (Prefab), each of which is called an instance (Instance).

To create a copy of a preset, drag the preset under the preset folder directly from the Project View (project) to the hierarchy view (Hierarchy) or scene view.

Once you have an instance of a preset (Prefab), you can place and adjust it at will.

4. Add components (Component) and scripts (Scripts)

Once you have a preset (Prefab) or a highlighted game object (Gameobject), you can add additional functionality to it using components.

To add a component, you only need to select a component (Component) from the Components (Component) menu in the Game object (Gameobject). After that, you will see that the component (Component) appears in the viewer (Inspector) of the game object.

A script (Scripts) is also a component.

If the added component disconnects the game object (Gameobject) from the preset (Prefab), you can re-establish the connection by applying the change to the preset (apply changes to Prefab) using the Game object (Gameobject) in the menu.

5. Place the Game object (Gameobject)

When you put a game object (Gameobject) into a scene, you can use the shortcut toolbar's Transform tool (Transform tools) to place it anywhere.

In addition, you can use the values under the transform (Transform) tab in the Viewer (Inspector) to fine-tune the position and rotation angle of the game object.

6. Using the camera (cameras)

The camera (cameras) is the eye of the game. All the content that the player sees when playing the game is displayed through one or more cameras (camera objects).

You can place, rotate, and parent-child cameras like any other game object (Gameobject). Because the camera is a game object (Gameobject) with a camera component (Component). As a result, it has some camera-specific features in addition to the functionality of the regular game object (Gameobject).

Some useful camera scripts are installed in the script (Scripts) resource bundle. You can install a script (Scripts) resource bundle at the same time when you create a new project, or by selecting the Assets-> Import package for the menu.

The imported script can be found in components-> Camera-control in the menu.

7. Light source (Lights)

In addition to some rare cases, it is generally necessary to add a light source (Lights) to the scene.

Double-click Car under scenes to observe the lights that have been added:

There are three types of light sources, each of which varies. The most important thing is that they add to the atmosphere and feel of the game. Different light sources can completely change the game situation, the effective use of light source will be an important learning topic.

It is also described in a special section later in this chapter. Ii. assets-Preservation and organization of resources

The Assets folder under Project is used to save and organize various resources in the Unity project.

1. Resource Work Flow

The steps described here to use a single resource in unity are common steps, and only basic operations are outlined. For example, the use of a three-dimensional (3D) mesh.

2. Create Rough Resources

You can use any supported three-dimensional (3D) modeling software to create a rough resource. For example, using 3Dmax, Maya, and so on. What modeling models can be imported is also described separately in the later chapters.

3. Create and update resources

If you are creating a game and need to add any type of new resource, you only need to create this resource and save it under the resource (Assets) folder. When you return or start unity, the files that you add are automatically detected and automatically imported into the Unity project.

In addition, unity can automatically detect changes and re-import changed resources when you update and save resources in software such as 3Dmax, Maya, and so on on this machine. This allows you to focus on optimizing resources without worrying about inconsistencies between resources and unity.

(1) Default value

On some importers, you can specify default values for field references or similar transactions. To specify a default value, open the object selector on the field where you want to set the default value, and then select a value on the object selector.

(2) Resource type

Here are some basic resource types that you can use to create your game. Includes: (a) mesh files and animations (animations)

Regardless of which three-dimensional resource bundle is used, unity imports meshes and animations from each file.

You do not need to import animations to use mesh files only. If you use animations, you can choose to import all animations from a single file or import the files that contain each animation individually.

After you import a mesh into unity, you can drag it to the scene or hierarchy view (Hierarchy) to create an instance of the mesh. You can also add components to an instance without adding them as attachments to the grid file itself.

Unity uses Uvs (that is, two-dimensional texture maps) and a large number of default materials (materials) (one for each UV) to import the mesh (mesh). This allows you to assign the corresponding texture file to the material and then populate the Unity game engine with the appearance of the grid. (b) Texture file (Texture files)

Unity supports all image formats. Even layered photoshop files can be imported without damaging the original Photoshop format. This allows you to easily and hassle-free processing of individual texture files for a streamlined and smooth experience.

Note: The texture size used should be 2 ascending (such as 32x32, 64x64, 128x128, 256x256, etc.), which may cause negative effects such as loading, slow processing, and possibly mosaic.

To import a texture, simply put the texture into the project's resource (Assets) folder, and the texture will automatically appear in the Project view.

In addition, you need to assign textures to materials before you can apply them to meshes, particle systems (particle system), or GUI textures (GUI Texture).

You can also convert textures to cube maps (CUBEMAP) or normal maps (NORMALMAP) of different app types in the game using Import settings (Settings).

4. Import Resources

The first time you save a resource, you should keep it under general in the resources (Assets) folder under Project. The benefit of this is that unity will detect the resource and automatically import it into the project once the Unity project is opened.

Note that Unity uses the FBX export functionality provided by the modeling software (such as 3Dmax, Maya, and so on) to convert the model to the FBX file format, requiring that the software have FBX export packages for unity to invoke automatically.

You can also export it directly to FBX in your application and save it under the project folder.

When you add files to the resources (Assets) folder of the project folder, Unity automatically detects the files. When you put any resource (Assets) into a resource folder, the resource (Assets) is automatically displayed in the Project view.

When you organize your project view, it is important to keep in mind the following key things:

Never move any resources outside of unity management or organize this folder. You must always use Project view to do this!

This is because unity stores the relationship metadata between a large number of resource files. This data is used where unity can find these resources. If you move resources within Project view, these relationships are preserved. If you move resources outside Unity, these relationships will be broken.

Also, if you select a resource in Project view, the import settings for that resource automatically appear in the viewer (Inspector). The options that are displayed are automatically changed based on the type of resource selected.

(1) Adding resources to the scene

You can add it to a scene by simply clicking the mesh in the Project view (mesh) and dragging it to the level view (Hierarchy) or scene view.

When you drag a mesh into a scene, a game object (Gameobject) with a mesh renderer (mesh Renderer) component (Component) is created.

If you want to use a texture or sound file, you need to add it to a game object (Gameobject) that already exists in the scene or Project (project).

(2) putting different resources together

The relationships between the most commonly used resources are outlined below. (a) applying textures (Texture) to materials (Material)

You can apply a material (Material) to a Game object (Gameobject), and the object becomes a component with a mesh renderer (mesh Renderer Component) after it is applied.

You can apply an animation (Animation) to a Game object (Gameobject), and the object becomes a drawing-driven component (Animation Component) after it is applied

You can apply a sound file to a game object (Gameobject), and the object becomes a component with a sound source (audio source Component)) (b) Create a preset

Presets (prefabs) are collections of Game objects (Gameobject) and Components (Component) that can be reused in a scene.

A preset (Prefab) can create multiple identical objects, called instantiations. For example, to create a tree preset (Prefab), you can instantiate multiple trees of the same tree and put them into the scene. All trees are linked together with presets (Prefab), so any changes you make to the preset (PREFAB) are automatically applied to all instances of the tree. If you want to change the grid, material, or any other item, you only need to change it once in the preset (Prefab), and then all other trees inherit the changes. You can also change an instance and then choose Game Objects (Gameobject) on the main menu to apply the changes to the preset (apply changes to Prefab), which saves you a lot of time setting up and updating resources.

If the game object (Gameobject) contains multiple components (Component) and a sub-game object (Gameobject) level, you can create a preset (Prefab) in the top-level game object (Gameobject) (root). Then use the entire collection of Game objects (Gameobject).

You can use Presets (Prefab) as a blueprint for your game object (GAMEOBJECT) structure. All preset (Prefab) clones are identical to the blueprint. If the blueprint is updated, then all the clones will also be updated. There are several ways to update presets (PREFAB) itself, by changing one of its clones and applying the changes to the blueprint implementation. For more information on using and updating presets (Prefab), please visit the Presets (prefabs) page.

To really create a preset (Prefab) from the scene's game object (Gameobject), simply drag the game object (Gameobject) from the scene to the project, and you'll see the game object's name text blue and the new preset (PREFAB) Any name. You have now created a reusable preset (PREFAB).

(3) Update resources

You have imported, instantiated resources, and linked to Presets (Prefab). When you want to edit the source resource, simply double-click it in the Project view. The application will be launched and can be changed as desired. Save when the update is complete. Then, when you switch back to Unity, the update is detected and the resource is re-imported. The link to the resource to the preset (Prefab) will also be retained. The effect you see is that the preset (PREFAB) will be updated. This is all the information necessary to update the resource. Open and Save!

(4) Tagging resources "optional"

Tagging resources is always a good idea if you want to keep all your resources in an orderly state. With the label, you can search for each resource-related label in the search bar of the drawing view or the object selector.

To add a tag (label) to a resource (Asset):

(from Project view), select the resource (Asset) for which you want to add a label.

If the resource does not have any associated labels (Labels), click Add Label in the viewer.

If the resource has a label associated with it, click the label (Labels) where it is located.

Start writing labels (Labels).

Attention:

(a) any resource may have more than one label.

(b) to split/create a label, simply press ENTER when writing the resource signature.

Organization of the "Unity" 2.3 Project Browser and resources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.