-
-
Save kirillrybin/1f82720e709b714c1f0b to your computer and use it in GitHub Desktop.
GenerateStaticCubemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class GenerateStaticCubemap : ScriptableWizard { | |
public Transform renderPosition; | |
public Cubemap cubemap; | |
void OnWizardUpdate(){ | |
helpString = "Select transform to render from and cubemap to render into"; | |
if (renderPosition != null && cubemap != null){ | |
isValid = true; | |
} else { | |
isValid = false; | |
} | |
} | |
void OnWizardCreate(){ | |
var go = new GameObject("CubeCam", typeof(Camera)); | |
go.transform.position = renderPosition.position; | |
go.transform.rotation = Quaternion.identity; | |
go.camera.RenderToCubemap(cubemap); | |
DestroyImmediate(go); | |
} | |
[MenuItem("Window/Render Cubemap")] | |
static void RenderCubemap(){ | |
ScriptableWizard.DisplayWizard("Render CubeMap", typeof(GenerateStaticCubemap), "Render!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment