Skip to content

Commit 5903a16

Browse files
author
SolidAlloy
committed
fix: Marked GenericScriptableObject.CreateInstance() as pure method
This will ensure users assign the returned instantiated scriptable object to a variable
1 parent a71209d commit 5903a16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Runtime/GenericScriptableObject.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GenericScriptableObject : ScriptableObject
1515
/// <summary>Creates an instance of <see cref="ScriptableObject"/>. Has support for generic scriptable objects.</summary>
1616
/// <param name="type">Type derived from <see cref="ScriptableObject"/>.</param>
1717
/// <returns>Instance of <paramref name="type"/>.</returns>
18-
[PublicAPI, CanBeNull]
18+
[PublicAPI, CanBeNull, Pure]
1919
public static new ScriptableObject CreateInstance(Type type)
2020
{
2121
if ( ! type.IsGenericType)
@@ -36,7 +36,7 @@ public class GenericScriptableObject : ScriptableObject
3636
/// </summary>
3737
/// <typeparam name="T">Type derived from ScriptableObject.</typeparam>
3838
/// <returns>Instance of <typeparamref name="T"/>>.</returns>
39-
[PublicAPI, CanBeNull]
39+
[PublicAPI, CanBeNull, Pure]
4040
public static new T CreateInstance<T>()
4141
where T : ScriptableObject
4242
{
@@ -58,7 +58,7 @@ public class GenericScriptableObject : ScriptableObject
5858
/// If the number of generic argument types passed into the method is not equal to the number of generic
5959
/// arguments the type can take.
6060
/// </exception>
61-
[PublicAPI, CanBeNull]
61+
[PublicAPI, CanBeNull, Pure]
6262
public static GenericScriptableObject CreateInstance(Type genericTypeWithoutTypeParams, params Type[] paramTypes)
6363
{
6464
int genericArgCount = genericTypeWithoutTypeParams.GetGenericArguments().Length;

0 commit comments

Comments
 (0)