共用方式為


自訂 VSTU 所建立的專案檔案

Unity 在專案檔案產生期間提供回調函數。 實作 OnGeneratedSlnSolutionOnGeneratedCSProject 方法,使用 AssetPostprocessor 在每次重新產生專案或解決方案檔案時修改它們。

演示

如何自訂 Visual Studio Tools for Unity 所產生的 Visual Studio 專案檔案。

Example

using System;
using UnityEditor;
using UnityEngine;

public class ProjectFilePostprocessor : AssetPostprocessor
{
  public static string OnGeneratedSlnSolution(string path, string content)
  {
    // TODO: process solution content
    return content;
  }

  public static string OnGeneratedCSProject(string path, string content)
  {
    // TODO: process project content
    return content;
  }
}