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 UnityEngine.Rendering; | |
using UnityEngine.Rendering.Universal; | |
[ExecuteInEditMode] | |
public class CustomPass : MonoBehaviour | |
{ | |
public Mesh mesh; | |
public Material material; | |
DrawMeshPass m_DrawMeshPass; |
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
1) Enable Profiler in OnPreprocessBuild like following: | |
public void OnPreprocessBuild(BuildReport report) | |
{ | |
Profiler.enabled = true; | |
Profiler.enableBinaryLog = true; | |
Profiler.logFile = "profilerlog.raw"; | |
Debug.Log("Enabling Profiler"); | |
} | |
2) Disable Profiler in OnPostProcessBuild | |
3) Now put Profiler.Begin/EndSample in the desired code. |
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
1. Create a new XCode Metal (library) project. | |
2. Edit Scheme. Product->Scheme->Edit Scheme | |
3. Run, Info tab, and point to your application | |
E.g. /Application/Unity/Hub/Editor/Unity.app | |
4. Run, Arguments tab to add cmdline arguments | |
E.g. -projectPath "/Users/name.name/projects/MyProject" | |
5. Run, Options tab, set to GPU Frame Capture to Metal | |
6. Run the project and click the camera icon from XCode to take a capture |
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
Shader "Universal Render Pipeline/Custom/UnlitTextureShadows" | |
{ | |
Properties | |
{ | |
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1) | |
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {} | |
} | |
SubShader | |
{ |
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
Shader "Custom/UnlitTexture" | |
{ | |
Properties | |
{ | |
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1) | |
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {} | |
} | |
// Universal Render Pipeline subshader. If URP is installed this will be used. | |
SubShader |
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 System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Text; | |
#if UNITY_EDITOR | |
using UnityEditor.Experimental.Rendering.LightweightPipeline; | |
#endif | |
using UnityEngine.Experimental.GlobalIllumination; | |
using UnityEngine.Rendering; | |
using UnityEngine.Rendering.PostProcessing; |
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 UnityEngine.Rendering; | |
using UnityEngine.Rendering.LWRP; | |
public class CustomRenderPassFeature : ScriptableRendererFeature | |
{ | |
class CustomRenderPass : ScriptableRenderPass | |
{ | |
// This method is called before executing the render pass. | |
// It can be used to configure render targets and their clear state. Also to create temporary render target textures. |
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
namespace UnityEngine.Rendering.LWRP | |
{ | |
// A renderer feature contains data and logic to enqueue one or more render passes in the LWRP renderer. | |
// In order to add a render feature to a LWRP renderer, click on the renderer asset and then on the + icon in | |
// the renderer features list. LWRP uses reflection to list all renderer features in the project as available to be | |
// added as renderer features. | |
public class FullScreenQuad : ScriptableRendererFeature | |
{ | |
[System.Serializable] | |
public struct FullScreenQuadSettings |
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
Use https://gist.github.com/phi-lira/225cd7c5e8545be602dca4eb5ed111ba instead. |
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
// Script made by aleks01010101 | |
// Slightly modified | |
// Displays avg and median ms + frames sampled during clipLenght | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PerfTracker : MonoBehaviour { | |
public float clipLength = 20.0f; |
NewerOlder