if ( GUILayout.Button ("Select Camera Object in Scene")) {
if (Selection.activeGameObject) {
this.obj = Selection.activeGameObject;
}
}
if (this.obj != null) {
EditorGUILayout.HelpBox ("obj name : " + this.obj.name, MessageType.None);
}
EditorGUILayout.Space ();
if (this.obj != null) {
if (GUILayout.Button ("Render to Cubemap")) {
this.renderToCubeMap();
}
}
}
void renderToCubeMap() {
if (this.cubemap != null && this.obj.camera != null) {
this.obj.camera.RenderToCubemap(this.cubemap);
}
else if (this.obj.camera == null) {
Debug.Log("Please make sure the gameObject has the camera component");
}
else if (this.cubemap == null) {
Debug.Log("Please select the cubemap, and try again.");
}
}
}