文档

支持

Unity Studio

Open Unity Studio

Unity Studio

Create a method

Instructions on how to create a method for your Logic script.
阅读时间1 分钟最后更新于 1 个月前

Create methods to organize your Logic script into smaller, reusable sections of code. To create a method, use the following steps:
  1. Open your Logic script.
  2. Select the Add (+) icon next to Methods. The New Method window displays.
  3. Change the settings to your preferences. For information about each of the settings, refer to Methods window UI reference.
  4. If you want to add parameters to your method:
    1. In the Parameters section, enter a name for your parameter. Make sure the name doesn't contain spaces.
    2. Select the type of value the parameter accepts from the Type dropdown.
    3. Select Add to add the parameter to your method.
  5. Select Create.

Additional resources