UnityLearn_Beginner_UnityTips

UnityLearn_Beginner_UnityTips

Tutorial. Unity Tips

Unity Official Tutorials _BeginnerLevel

https://learn.unity.com/tutorial/unity-tips#5c7f8528edbc2a002053b481

Snap

When the move, rotate, scale objects, can press Ctrl / Cmd key can be changed in steps.
For example each move 1m, each 15 ° of rotation and the like
steps can Edit - set> Snap Settings in

Preview Window:

Inspector panel resource files following a Preview panel, in general, is fixed in the Inspector under.
May bar right above the Preview panel, you can undock it

Quickly locate the Camera position :

Scene in the viewing angle to a suitable position and angle need to change the selected Camera, select GameObject -> Align With View
  can be adjusted to the position and angle of the camera in the perspective Scene

After selecting a Camera, select GameObject -> Align View To Selected
  may be adjusted to the Scene Camera in the same perspective

Adjust public variable adjustment Slider.value the same as in the Inspector :

Plus variable Range decoration on public:
  [the Range (1.0f, 10.0f)]  to

Show private variable in the Inspector :

public variable may be displayed in the Inspector panel
, however, in order to display the Inspector panel, using the public, then vialate the encapsulation principle
solution: [SerializeField] attribute

Large-scale projects and pay attention:

Before Starting:

Source Control:

Unity Editor integrated source control service: Collaborate

Use external source control: Git / Svn / Mercurial / Perforce and other tools, you need to pay attention
1. Do not include the Library, the Temp, obj , because when you open the project on another computer that does not require these files
  they will lead to clutter the repository, and take up a lot of storage space
2. Version Control to  the Visible Meta files :
  the meta files placed on the assets side of the resource file, which stores the meta files related to property values and setting values
  to do so, then you can configure these resources to share files between team members provided
  otherwise, the meta files stored in the Library folder, a common cause can not be uploaded to Git
3.  Asset the Serialization  to  Force the text :
  the make Unity All files (ScriptableObjects, Scenes, prefabs and MANY Others) A use of text A binary representation INSTEAD one.
  doing so 1. Source control stores only the changes to these files, rather than a complete copy of the file
  2. change the file manually merge the conflicts
  early in the project to carry out asset serialization setting is recommended

Scales and Standards:

Units:

For rigidbody 3D games: 1 unit = 1 meter, to physically accurate simulation engine

For 2D game rigidbody: definition of a "base sprite size" to determine the 1 base size = 1 unit = 1 meter
  , such as provided 32px = 1 meter = 1 unit.
  All of the Sprite Pixel Per Unit that value (32 ) to simulate the physics engine

Naming Convention:

File names of all resource files follow the same Naming Convention.
For example:
  Appending suffixes: Normal for the Map, such as _N, _AO for Ambient Occlusion the Map
  prefixes: for example LowRes_ and HighRes_
easy to: 
  filter Search through
  the Write Custom Setting value Importer Automatically

Project Structure:

Folders:

.meta file record set corresponding to the resource import file (import settings)
Thus, the need to operate when moving in the resource file in the Project View Editor Unity, Unity will do so moving everything properly take care of
or moving the operating system Explorer, when the corresponding meta file also moved with the resource file, otherwise it will lead to the loss of a reference loss (lose references) and importing settings

Create rules folder :
  two methods follow:
  1. A Folder for each type of Asset, and make subfolders per Objects / Zones
    such as (Assets / Materials; Assets / prefabs; Assets / Materials / Level-1;)
  2. A Folder per objects / zones
    such as (Assets / Level1 / Enemy / Archer ; Assets / Shared / UI; Assets / Forest / Trees)
    All relevant resources are placed in the corresponding folder
    , such as (Assets / Forest / Trees / BigTree.fbx ; Assets / Forest / Trees / SmallTree.mat)

If the project uses Assets Bundles , the second method is convenient
  can easily create bundles per content themes by adding the parent folder to a specific bundle
  and splitting the related assets through different bundles.

Prototype Folders:

原文: Keep everything that is related to a prototype or placeholder in a separate folder hierarchy, and avoid cross referencing between those folders and folders which contain shippable assets/code. For example, your Character prefab in the "normal" file hierarchy should not reference a test material in your Prototype folders. Create a prototype character prefab that would reside in the Prototype folders and never use that prefab in a non prototype scenes (you could even write editor scripts that check references used by objects in the prototype folder to be sure that this rules is enforced. )

Resources:

Possible resources stored in the Resources folder.

Resources folder resources () is dynamically loaded by script Resources.Load,
but Unity is not to judge whether the folder resources were to be loaded / use, so all resources will be packed to the Build

Use path / filename, late in the project will increase the cost of management, such as file directory changes, name changes and other resources
  recommended way:
    1. Use direct reference: a way to drag the script variables
    2. If you really need to use Resources. Load, please use Resources.LoadAsync ()
      method will not block execution
      on some devices, Loading will take a long time

ResourceRequest request = Resources.LoadAsync("cube");

request.completed += operation => {
    ResourceRequest op = operation as ResourceRequest;
    Instantiate(op.asset);
};

Assets:

Ensure that the resource file is small:
  For example, for a texture resource can be reduced at the time of import into the unity resolution
  but this does not reduce the time to import resources, leading to the first initial setup time becomes longer works

Use compression format :
  conduct of the image and audio file compression
  Image: Use .png / .tga / .tiff / If the graphics software supports it, you can also use .dds
  audio: use .ogg

Definition Files Assembly :
  . All the compile scripts in the ADF and the ITS make subfolders INTO A Folder A separate DLL
  just recompiled dll modified script belongs, can effectively speed up compilation
  such as modifying the script about the Enemy, just compiled recompile Enemy corresponding to dll

Scenes Structure:

Hierarchy depth and count:

 

Organization:

 

Dynamic Objects in Editor:

 

Game Design and Features:

Create cheat function:

 

Use small feature test scenes:

 

 

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/FudgeBear/p/11141001.html