using UnityEngine; using UnityEditor; using System.Collections; public class RenderCubemapWizard : ScriptableWizard { public Transform renderFromPosition; public Cubemap cubemap; void OnWizardUpdate () { helpString = "Select transform to render from and cubemap to render into"; isValid = (renderFromPosition != null) && (cubemap != null); } void OnWizardCreate () { // create temporary camera for rendering GameObject go = new GameObject( "CubemapCamera"); go.AddComponent(); // place it on the object go.transform.position = renderFromPosition.position; // render into cubemap go.GetComponent().RenderToCubemap(cubemap); // destroy temporary camera DestroyImmediate( go ); } [MenuItem("GameObject/Render into Cubemap")] static void RenderCubemap () { ScriptableWizard.DisplayWizard( "Render cubemap", "Render!"); } }