Skip to content

Commit

Permalink
Fixed gizmos no longer allocate memory in game view. [case 1328852]
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaschod committed May 27, 2021
1 parent 4eca1ac commit 9b48e7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed shaderGraph shaders to render into correct depthNormals passes when deferred rendering mode and SSAO are enabled.
- Fixed ordering of subshaders in the Unlit Shader Graph, such that shader target 4.5 takes priority over 2.0. [case 1328636](https://issuetracker.unity3d.com/product/unity/issues/guid/1328636/)
- Fixed issue where it will clear camera color if post processing is happening on XR [case 1324451]
- Fixed gizmos no longer allocate memory in game view. [case 1328852]

### Changed
- Change Asset/Create/Shader/Universal Render Pipeline/Lit Shader Graph to Asset/Create/Shader Graph/URP/Lit Shader Graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ public static string GetName(this CameraRenderType type)
[ImageEffectAllowedInSceneView]
public class UniversalAdditionalCameraData : MonoBehaviour, ISerializationCallbackReceiver
{
const string k_GizmoPath = "Packages/com.unity.render-pipelines.universal/Editor/Gizmos/";
const string k_BaseCameraGizmoPath = k_GizmoPath + "Camera_Base.png";
const string k_OverlayCameraGizmoPath = k_GizmoPath + "Camera_Base.png";
const string k_PostProcessingGizmoPath = k_GizmoPath + "Camera_PostProcessing.png";

[FormerlySerializedAs("renderShadows"), SerializeField]
bool m_RenderShadows = true;

Expand Down Expand Up @@ -562,17 +567,16 @@ public void OnAfterDeserialize()

public void OnDrawGizmos()
{
string path = "Packages/com.unity.render-pipelines.universal/Editor/Gizmos/";
string gizmoName = "";
Color tint = Color.white;

if (m_CameraType == CameraRenderType.Base)
{
gizmoName = $"{path}Camera_Base.png";
gizmoName = k_BaseCameraGizmoPath;
}
else if (m_CameraType == CameraRenderType.Overlay)
{
gizmoName = $"{path}Camera_Overlay.png";
gizmoName = k_OverlayCameraGizmoPath;
}

#if UNITY_2019_2_OR_NEWER
Expand All @@ -590,12 +594,12 @@ public void OnDrawGizmos()

if (renderPostProcessing)
{
Gizmos.DrawIcon(transform.position, $"{path}Camera_PostProcessing.png", true, tint);
Gizmos.DrawIcon(transform.position, k_PostProcessingGizmoPath, true, tint);
}
#else
if (renderPostProcessing)
{
Gizmos.DrawIcon(transform.position, $"{path}Camera_PostProcessing.png");
Gizmos.DrawIcon(transform.position, k_PostProcessingGizmoPath);
}
Gizmos.DrawIcon(transform.position, gizmoName);
#endif
Expand Down

0 comments on commit 9b48e7f

Please sign in to comment.