文档

​
​

Development

User Acquisition

Monetization

工业

Unity Version Control

DevOps

On-prem

Gluon

Editor plug-in

Open Unity Dashboard

Unity Version Control

此页面不支持所选语言。
​
​
Unity Version Control
  • Overview
  • Cloud Repositories organization update
  • Installation
  • Use UVCS with the Unity Editor
  • Unity Version Control plugins
  • Concepts
  • Tutorials
    • Migrate from Git
    • Migrate from Perforce
    • Version Control settings
    • Configure the client
    • Version Control workflow
    • Version Control tools
      • Enable dynamic workspaces (Windows)
      • Create a label
      • Create an attribute
      • Create a mergebot
      • Use Smart Locks
      • Use Xlinks
      • Use Unity Samples
      • Use triggers
        • Create your first trigger
        • Trigger checkin samples
        • Verify label creation
        • Update files before checkout
        • Example triggers
        • Create a Slack web trigger
        • Create a Discord web trigger
      • Transfer project to a different organization
  • On-Prem
  • Gluon
  • CLI and shortcut references
  • Release Notes
  1. Unity Version Control (previously Plastic SCM)

Example triggers

Explore example triggers for automating workflows in Unity Version Control.
阅读时间2 分钟
最后更新于 10 个月前

The following examples show you sample triggers that you can use to optimize your version control workflows.

Backup trigger

Create a trigger that fires after setting a workspace selector, located at
/home/scripts/plastic-backup
at the server, and give it the name backup:
cm trigger create after-setselector backup /home/scripts/plastic-backup

Validation triggers

Label validation

Create a trigger called that fires before a label is created, that calls
validate-label.bat
at server
myserver
on port
8084
:
cm trigger create before-mklabel "Validate label" "c:\tmp\triggers\validate-label.bat" --server=myserver:8084
Create a trigger that fires before a label is created in repository default and that label starts with bl or fix:
cm trigger create before-mklabel "label-bl-fix" "c:\tmp\triggers\label-bl-fix.bat" --filter="rep:default,bl*,fix*"

Check in validation

Create a trigger that validates check in contents before the check in is actually performed in the repository, on a Windows server:
cm trigger create before-checkin ensure-code-stds "c:\plastic\triggers\checkcode.bat"

Web trigger notifications

URI notification

Create a web trigger that fires after a check in action is performed, at URI
https://www.mysite.com/api/team/checkin
and name it
Notify team
:
cm trigger create after-checkin "Notify team" "webtrigger https://www.mysite.com/api/team/checkin"
A request body example of that web trigger would be as follows:
{ "PLASTIC_CHANGESET": "cs:2341@br:/main/task4638@rep:product@repserver:plastic.mysite.com:17590", "PLASTIC_CLIENTMACHINE": "DEV1HOST", "PLASTIC_COMMENT": "Fixing command line parsing", "PLASTIC_SERVER": "plastic.mysite.com:17590", "PLASTIC_SHELVE": false, "PLASTIC_USER": "dev1", "INPUT": [ "CH \"/src/main.c\" FILE" ]}

Discord notification

Create a web trigger that fires after a check in and send notifications from the server to the specified Discord channel:
cm trigger create after-checkin NotifyTeam "webtrigger-discord https://discordapp.com/api/webhooks/<channelId>/<token>" --server=localhost:18084

Slack notification

Create a web trigger that fires after a check in and send notifications from the server to the specified Slack channel:
cm trigger create after-checkin SlackWebTrigger "webtrigger-slack https://slack.com/api/chat.postMessage/<channelId or UserId>/xoxb-SlackBotToken" --server=localhost:18084

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Backup trigger

    • Validation triggers

      • Label validation

      • Check in validation

    • Web trigger notifications

      • URI notification

      • Discord notification

      • Slack notification


报告此页面的问题