VolumeFactory.cs 688 B

123456789101112131415161718192021
  1. using UnityEngine;
  2. using UnityEngine.Rendering.PostProcessing;
  3. namespace UnityEditor.Rendering.PostProcessing
  4. {
  5. internal static class VolumeFactory
  6. {
  7. [MenuItem("GameObject/3D Object/Post-process Volume")]
  8. static void CreateVolume()
  9. {
  10. var gameObject = new GameObject("Post-process Volume");
  11. var collider = gameObject.AddComponent<BoxCollider>();
  12. collider.size = Vector3.one;
  13. collider.isTrigger = true;
  14. gameObject.AddComponent<PostProcessVolume>();
  15. Selection.objects = new [] { gameObject };
  16. EditorApplication.ExecuteMenuItem("GameObject/Move To View");
  17. }
  18. }
  19. }