Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 67a1c17

Browse files
TJHeuvelChman
authored andcommitted
Added a GetSetting overload to profile. Often the user knows exactly what settings exist in a profile, and the code can be more readable using this variant. Its more similar to GetComponent too, which any Unity developer is quite familiar with.
1 parent ef5135f commit 67a1c17

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

PostProcessing/Runtime/PostProcessProfile.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ public bool HasSettings(Type type)
100100
return false;
101101
}
102102

103+
public T GetSetting<T>() where T : PostProcessEffectSettings
104+
{
105+
foreach (var setting in settings)
106+
{
107+
if (setting is T)
108+
return setting as T;
109+
}
110+
return null;
111+
}
112+
103113
public bool TryGetSettings<T>(out T outSetting)
104114
where T : PostProcessEffectSettings
105115
{

0 commit comments

Comments
 (0)