Version: 2017.4
Control de Versiones
Integración Perforce

Version control integration

Unity supports version control integration with Perforce and Plastic SCM. Refer to those pages for specific information regarding your choice of version control.

Using a version control system makes it easier for a user (or multiple users) to manage their code. It is a repository of files with monitored access. In the case of Unity, this is all the files associated with a Unity project. With version control, it is possible to follow every change to the source, along with information on who made the change, why they made it, and what they changed. This makes it easy to revert back to an earlier version of the code, or to compare differences in versions. It also becomes easier to find out when a bug first occurred, and with what changes might have caused it.

Setting up your version control in Unity

Get your version control software setup according to its instructions, then follow these steps:

  1. Set up or sync a workspace on your computer using your chosen client (refer to the Plastic SCM Integration guide or the Perforce Integration guide for help with this step).

  2. Copy an existing project into the workspace, or start Unity and create a new project in the workspace.

  3. Open the project and go to Edit > Project Settings > Editor.

  4. Under Version Control, choose your Mode according to the version control system that you chose.

  5. Llene los ajustes de su version control, como el nombre de usuario / contraseña/ servidor / espacio de trabajo.

  6. Keep Automatic add checked if you want your files to be automatically added to version control when they’re added to the project (or the folder on disk). Otherwise, you need to add new files manually.

  7. You have the option to work offline. This mode is only recommended if you know how to manually integrate changes back into your version control software (Working offline with Perforce).

  8. You can edit the Asset Serialization, Default Behaviour Mode and Sprite Packer options to suit your team’s preferences and choice of version control.

  9. Click Connect and verify that “Connected” is displayed above the Connect button after a short while.

  10. Use your standard client (e.g. p4v) to make sure that all files in the Assets and ProjectSettings folders (including files ending with .meta) are added.

N.B. En cualquier punto usted puede ir al menú de Prefences y seleccionar External Tools y ajustar la herramienta Diff/Merge de su Revision Control.

Using version control

En este punto usted debe ser capaz de hacer la mayoría de operaciones importantes de version control directamente haciendo click derecho en lo assets en el project view, en vez de ir a través del cliente de version control. Las operaciones de version control varían dependiendo en qué version control escoja, esta tabla muestra qué acciones están directamente disponibles para cada version control:

Operación de Version Control Descripción Perforce Plastic SCM
Check Out Permite que se hagan cambios al archivo
Diff against head Compara las diferencias entre los archivos a nivel local y en el encabezado
Get Latest Obtiene los últimos cambios y el archivo de actualización No*
Lock Previene que otros usuarios hagan cambios al archivo No**
Mark Add Agrega localmente pero no a version control
Resolve Conflicts Para resolver conflictos en un archivo que ha sido cambiado por múltiplos usuarios No***
Revert Descarta los cambios realizados a archivos abiertos cambiados
Revert Unchanged Descarta los cambios realizados a archivos abiertos sin modificar
Submit Envía el estado actual del archivo a version control (control de versiones)
Unlock Suelta lock y permite que se hagan cambios por cualquiera No**

* To get the latest changes and update the file using Plastic SCM, you need to use the version control window.

** Locking and Unlocking using Plastic SCM require you to edit a specific Plastic SCM lock file externally, see the Plastic SCM Integration page for more information.

*** Conflicts are shown within the version control menu but resolved in the Plastic SCM GUI.

Plastic SCM Version Control Operations en Mac
Plastic SCM Version Control Operations en Mac
Perforce Version Control Operations en Windows
Perforce Version Control Operations en Windows

Version Control Window

Usted puede mirar sus archivos en su changelist desde Version Control Window (Window->Version Control). Se muestra aquí acoplado junto al Inspector en el editor:

La pestaña ‘Outgoing’ lista todos los cambios locales que están pendientes de una confirmación en el version control, mientras que la pestaña ‘Incoming’ lista todos los cambios que necesitan ser sacados del version control.

Haciendo click derecho en los assets o en changelists en esta ventana hace que usted realice operaciones en estos. Para mover assets entre changelists simplemente arrastre los assets desde una changelist al encabezado del changelist de destino.

Icons

Los siguientes iconos son mostrados en el editor de Unity para visualizar el estatus del version control para archivos/assets:

Iconos Significado Información adicional
Archivo agregado localmente Adición pendiente a version control
Archivo agregado a version control por otro usuario Adición pendiente a version control
El archivo es checked out por usted Checked out localmente
El archivo es checked out por otro usuario Checked out a distancia
Ha habido un conflicto fusionando este archivo Necesita ser resuelto
El archivo ha sido eliminado por usted Una eliminación pendiente en version control
El archivo ha sido eliminado por otro usuario Una eliminación pendiente en version control
El archivo aún no está bajo version control n/a
El archivo está bloqueado por usted No puede ser modificado por otros usuarios
El archivo está bloqueado por otro usuario No puede ser modificado por usted
Otro usuario ha checked in una nueva versión de este archivo Use “Apply Incoming Changes” para obtener la última versión
The server is requesting the version control status of this file, or is waiting for a response You can only see this when using a centralised version control system like Perforce

Cosas para tener en cuenta:

  • Ciertos version controls o va a permitirle editar assets hasta que estén marcados como Checked out ( al menos de que tenga marcado Work offline).
  • Cuando guarde cambios a un archivo .scene automáticamente va a ser demarcado(Checked out).
  • Los Inspectors de Project Settings tienen un botón checkout en la parte inferior a la derecha que le permite marcar los ajuste.
  • Una advertencia amarilla va a aparecer normalmente para recordarle demarcar elementos con el fin de hacer cambios en ellos, esto en la mayoría aplica a los inspectors de Project Settings.
  • En Plastic SCM, los assets automáticamente generados como los lightmaps son automáticamente agregados/checked out.

Automatic revert of unchanged files on submit

Al trabajar con Assets, Unity comprueba automáticamente ambos el archivo asset como el archivo .meta asociado. En la mayoría de situaciones, sin embargo, el archivo .meta no es modificado, lo que podría causar un poco de trabajo adicional e.g. al combinar ramas en un momento posterior.

Offline mode

Unity apoya trabajar en modo fuera de linea, e.g, para continuar trabajando sin una conexión de red con el repositorio de su versión de control.

  • Seleccione Work offline desde los ajustes del version control, si quiere ser capaz de trabajar desconectado del version control.

Allow Async Update

Unity supports asynchronous version control status queries for some version control providers, such as Perforce. This option allows those providers to update the version control status of files without stalling Unity. Use this option when the connection to your version control server has high latency.

  • If you experience stalls during status queries, go to Version Control Settings and select Allow Async Update.

Note: Only status queries are asynchronous. Operations that change the state of files, or require up-to-date knowledge of file status, are performed synchronously.

Resolución de Problemas

If Unity cannot commit your changes to your version control client, (for example, if the server is down or license issues occur), your changes are stored in a separate changeset.

Working with the Asset Server

To learn more about working with the Asset Server (Unity’s internal version control system), see documentation on the Asset Server.

Working with other version control systems

To work with a version control system unsupported by Unity, select MetaData as the Mode for Version Control in the Editor Settings. This allows you to manage the source Assets and metadata for those Assets with a version control system of your choice. For more on this, see documentation on External Version Control Systems.


  • 2017–02–12 Page amended with limited editorial review

  • Documentation on asynchronous version control status queries added in Unity 2017.3.

Control de Versiones
Integración Perforce