Skip to content

Commit 28b4e0a

Browse files
kirill-titov-uEvergreen
authored andcommitted
[RPW] Rely on the type object instead of type name
https://jira.unity3d.com/browse/UUM-68021 `Type.name` was used which accidentally instantiate HDRP Volume component of the same name. As both of them are Scriptable Object it was produced an exception when use it and not when it instantiates.
1 parent af8e8fc commit 28b4e0a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Packages/com.unity.render-pipelines.universal/Editor/ScriptableRendererDataEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ private void AddShowAdditionalPropertiesMenuItem(FullScreenPassRendererFeature f
235235
menu.AddItem(EditorGUIUtility.TrTextContent("Show Additional Properties"), fullScreenFeature.showAdditionalProperties, () => fullScreenFeature.showAdditionalProperties = !fullScreenFeature.showAdditionalProperties);
236236
}
237237

238-
internal void AddComponent(string type)
238+
internal void AddComponent(Type type)
239239
{
240240
serializedObject.Update();
241241

242-
ScriptableObject component = CreateInstance((string)type);
243-
component.name = $"{(string)type}";
242+
ScriptableObject component = CreateInstance(type);
243+
component.name = $"{type.Name}";
244244
Undo.RegisterCreatedObjectUndo(component, "Add Renderer Feature");
245245

246246
// Store this new effect as a sub-asset so we can reference it safely afterwards

Packages/com.unity.render-pipelines.universal/Editor/ScriptableRendererFeatureProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public bool GoToChild(FilterWindow.Element element, bool addIfComponent)
6868
{
6969
if (element is FeatureElement featureElement)
7070
{
71-
m_Editor.AddComponent(featureElement.type.Name);
71+
m_Editor.AddComponent(featureElement.type);
7272
return true;
7373
}
7474

0 commit comments

Comments
 (0)