BakeTexturesFromTemplate
EZRecolorBaker.BakeTexturesFromTemplate()
public static BakeResult BakeTexturesFromTemplate(
GameObject prefab,
EZRecolorTemplate template,
string name,
bool addPrefabs = true,
List<EZRecolor.Objects.BakedPrefab> overridePrefabs = null,
EZRecolorComponent component = null,
bool useDialogErrorInstead = false,
bool useConsoleCompleteMsgInstead = false,
int returnBakedPrefabIndex = -1,
EZRecolor.Objects.BakedPrefab.Platform preferredReturnPlatform = EZRecolor.Objects.BakedPrefab.Platform.Unset
)
| Parameter | Type | Default | Description |
|---|---|---|---|
| prefab | GameObject | The prefab with the EZRecolor materials | |
| template | EZRecolorTemplate | The template to use | |
| name | string | Name of the recolor | |
| addPrefabs | bool | true | Add the baked prefab into the scene once the bake is complete? |
| overridePrefabs | List EZRecolor.Objects.BakedPrefab | null | A list that can override which prefabs are baked (such as for the EZRecolor Component) |
| component | EZRecolorComponent | null | If baked through an EZRecolor Component, pass it here, else null |
| useDialogErrorInstead | bool | false | If true, if the baker errors out due to Lite Edition limitations, display the error as a popup window. Else, just display it in the console |
| useConsoleCompleteMsgInstead | bool | false | Put the Completed Bake message in the console instead of a Dialog Windows |
| returnBakedPrefabIndex | int | -1 | This will return a specific Baked Prefab once baked. If -1, it'll take the one that is planned on being spawned in the scene. If anything else, it'll try to take the one at the index in the Baked Prefab's list in the Template, else default to the -1 behavior. |
| preferredReturnPlatform | EZRecolor.Objects.BakedPrefab.Platform | EZRecolor.Objects.BakedPrefab.Platform.Unset | Allows to set a preferred Platform for the returned prefab in case the ID doesn't exist, and returns the first one found of the selected platform. Null if non-existent. |
Returns: A Bake Result object containing all Baked Textures, Materials and Prefabs. Prefabs wise, if one fails to be created by the Baker, it will NOT be included in this returned Object.
Export an EZRecolor prefab into Textures, Materials and new Prefabs via an EZRecolor Template.
Example Usage
using UnityEngine;
using MikeDaBird.EZRecolor.Utilities.Editor;
class BakeFromScript : MonoBehavior{
public EZRecolorTemplate template;
public GameObject sourcePrefab;
public string name;
// Bake Textures using a Template and a Prefab, both set within the Component
public List<Texture2D> Bake(){
textures = EZRecolorBaker.BakeTexturesFromTemplate(sourcePrefab, template, name);
return textures;
}
}