自定义 VSTU 创建的项目文件

Unity 在项目文件生成过程中提供回调。 每当项目或解决方案文件重新生成时,使用 AssetPostprocessor 实现 OnGeneratedSlnSolutionOnGeneratedCSProject 方法。

演示

如何自定义 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;
  }
}