Created
February 11, 2021 15:25
-
-
Save togucchi/1b562b457482d4593c50f52ae75a84fa to your computer and use it in GitHub Desktop.
Switching Render Pipeline at runtime
This file contains hidden or 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 System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.Rendering; | |
| public class RuntimePipelineSwitcher : MonoBehaviour | |
| { | |
| [SerializeField] | |
| private RenderPipelineAsset pipelineAsset; | |
| private RenderPipelineAsset renderPipelineAsset; | |
| void Update() | |
| { | |
| if(Input.GetKeyDown(KeyCode.S)) | |
| { | |
| if (renderPipelineAsset == null) | |
| { | |
| renderPipelineAsset = pipelineAsset; | |
| } | |
| else | |
| { | |
| renderPipelineAsset = null; | |
| } | |
| GraphicsSettings.renderPipelineAsset = renderPipelineAsset; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment