Game Development Reference
In-Depth Information
Processing the build
A more interesting area for study, especially if you are working with many platforms and
find yourself doing repetitive tasks on each platform (or when you create your Unity as-
sets and need to copy files to a platform to work), is the ability to extend Unity3D's own
project build process.
Simply create a normal class script in Asset\Editor , and then create your build action
function with the [PostProcessBuild] attribute and the build function signature, as
follows:
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
public class MyBuildPostprocessor
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target,
string pathToBuiltProject)
{ }
}
The attributes from the build processing give you the following information:
BuildTarget : This tells you which platform is currently being built using the
BuildTarget enumeration.
Path : This gives you the output path where the build project is being written.
This is useful if you want to copy additional files to it.
You can also control the order in which this function is processed by adding parameters to
the [PostProcessBuild] attribute as follows:
[PostProcessBuild (10)]
public static void OnPostprocessBuild(BuildTarget target,
string pathToBuiltProject)
{ }
Search WWH ::




Custom Search