diff --git a/Assets/Editor/SourceGenerator/ModuleGenerator.cs b/Assets/Editor/SourceGenerator/ModuleGenerator.cs
index d2ef58f..4fc7694 100644
--- a/Assets/Editor/SourceGenerator/ModuleGenerator.cs
+++ b/Assets/Editor/SourceGenerator/ModuleGenerator.cs
@@ -16,7 +16,7 @@ public static class ModuleGenerator
private const string INFO_PATH = "Assets/Editor/SourceGenerator/module-info.json";
#region generate scripts
- internal static void WriteExtensionFile(string filePath, string nullableFilePath, PSModuleInfo module)
+ internal static void WriteExtensionFile(string filePath, PSModuleInfo module)
{
var builder = new StringBuilder();
var isSameAsPrevious = module.Properties.Any() && module.Properties.First().ReleaseVersion == module.ReleaseVersion;
@@ -25,8 +25,13 @@ internal static void WriteExtensionFile(string filePath, string nullableFilePath
$@"using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{{
public static class {module.Type}Extension
@@ -36,7 +41,18 @@ public static class {module.Type}Extension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem Edit{module.PropertyName.c2p()}(this ParticleSystem particleSystem, Action<{module.Type}> moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem Edit{module.PropertyName.c2p()}(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action<{module.Type}> moduleEditor)
{{
Debug.Assert(particleSystem != null, ""particleSystem cannot be null"");
Debug.Assert(moduleEditor != null, ""moduleEditor cannot be null"");
@@ -61,7 +77,14 @@ public static class {module.Type}Extension
/// Assign a value to
/// {obsolete}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem Set{module.PropertyName.c2p()}{property.PropertyName.c2p()}(this ParticleSystem particleSystem, {property.Type} {property.PropertyName.p2c()})
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem Set{module.PropertyName.c2p()}{property.PropertyName.c2p()}(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, {property.Type} {property.PropertyName.p2c()})
{{
Debug.Assert(particleSystem != null, ""particleSystem cannot be null"");
var module = particleSystem.{module.PropertyName};
@@ -73,7 +96,18 @@ public static class {module.Type}Extension
/// Edit
/// {obsolete}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem Set{module.PropertyName.c2p()}{property.PropertyName.c2p()}(this ParticleSystem particleSystem, Func<{property.Type}, {property.Type}> {property.PropertyName.p2c()}Changer)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem Set{module.PropertyName.c2p()}{property.PropertyName.c2p()}(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func<{property.Type}, {property.Type}> {property.PropertyName.p2c()}Changer)
{{
Debug.Assert(particleSystem != null, ""particleSystem cannot be null"");
Debug.Assert({property.PropertyName.p2c()}Changer != null, ""{property.PropertyName.p2c()}Changer cannot be null"");
@@ -96,7 +130,11 @@ public static class {module.Type}Extension
/// Edit
/// {obsolete}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static {module.Type} Set{property.PropertyName.c2p()}(this {module.Type} module, Func<{property.Type}, {property.Type}> {property.PropertyName.p2c()}Changer)
+ public static {module.Type} Set{property.PropertyName.c2p()}(this {module.Type} module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func<{property.Type}, {property.Type}> {property.PropertyName.p2c()}Changer)
{{
Debug.Assert({property.PropertyName.p2c()}Changer != null, ""{property.PropertyName.p2c()}Changer cannot be null"");
module.{property.PropertyName} = {property.PropertyName.p2c()}Changer(module.{property.PropertyName});
@@ -113,8 +151,6 @@ public static class {module.Type}Extension
");
File.WriteAllText(filePath, builder.ToString().Replace("\r\n", "\n"));
-
- File.WriteAllText(nullableFilePath, "#nullable enable\n" + builder.ToString().Replace("\r\n", "\n")); ;
}
///
@@ -132,9 +168,8 @@ public static void GenerateWithReflection()
});
foreach (var module in modules)
{
- var filePath = $"Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/{module.Type}Extension.cs";
- var nullableFilePath = $"Packages/FluentParticleSystem/Runtime/Nullable/Extensions/{module.Type}Extension.cs";
- WriteExtensionFile(filePath, nullableFilePath, module);
+ var filePath = $"Packages/FluentParticleSystem/Runtime/Extensions/{module.Type}Extension.cs";
+ WriteExtensionFile(filePath, module);
}
AssetDatabase.Refresh();
}
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Debug.cs b/Packages/FluentParticleSystem/Runtime/Debug.cs
similarity index 91%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Debug.cs
rename to Packages/FluentParticleSystem/Runtime/Debug.cs
index 53d6765..2bcdd33 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Debug.cs
+++ b/Packages/FluentParticleSystem/Runtime/Debug.cs
@@ -10,7 +10,7 @@ internal static class Debug
[Conditional("UNITY_ASSERTIONS")]
internal static void Assert(
#if UNITY_2020_2_OR_NEWER
- [DoesNotReturnIf(false)]
+ [DoesNotReturnIf(false)]
#endif
bool condition, string message)
{
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Debug.cs.meta b/Packages/FluentParticleSystem/Runtime/Debug.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Debug.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Debug.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions.meta b/Packages/FluentParticleSystem/Runtime/Extensions.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions.meta
diff --git a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/CollisionModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/CollisionModuleExtension.cs
similarity index 73%
rename from Packages/FluentParticleSystem/Runtime/Nullable/Extensions/CollisionModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/CollisionModuleExtension.cs
index cccc0a9..15c9504 100644
--- a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/CollisionModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/CollisionModuleExtension.cs
@@ -1,9 +1,13 @@
-#nullable enable
-using System;
+using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class CollisionModuleExtension
@@ -13,7 +17,18 @@ public static class CollisionModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditCollision(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditCollision(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -26,7 +41,14 @@ public static ParticleSystem EditCollision(this ParticleSystem particleSystem, A
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionBounce(this ParticleSystem particleSystem, MinMaxCurve bounce)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionBounce(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve bounce)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -38,7 +60,18 @@ public static ParticleSystem SetCollisionBounce(this ParticleSystem particleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionBounce(this ParticleSystem particleSystem, Func bounceChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionBounce(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func bounceChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(bounceChanger != null, "bounceChanger cannot be null");
@@ -61,7 +94,11 @@ public static CollisionModule SetBounce(this CollisionModule module, MinMaxCurve
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetBounce(this CollisionModule module, Func bounceChanger)
+ public static CollisionModule SetBounce(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func bounceChanger)
{
Debug.Assert(bounceChanger != null, "bounceChanger cannot be null");
module.bounce = bounceChanger(module.bounce);
@@ -74,7 +111,14 @@ public static CollisionModule SetBounce(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionBounceMultiplier(this ParticleSystem particleSystem, float bounceMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionBounceMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float bounceMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -86,7 +130,18 @@ public static ParticleSystem SetCollisionBounceMultiplier(this ParticleSystem pa
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionBounceMultiplier(this ParticleSystem particleSystem, Func bounceMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionBounceMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func bounceMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(bounceMultiplierChanger != null, "bounceMultiplierChanger cannot be null");
@@ -109,7 +164,11 @@ public static CollisionModule SetBounceMultiplier(this CollisionModule module, f
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetBounceMultiplier(this CollisionModule module, Func bounceMultiplierChanger)
+ public static CollisionModule SetBounceMultiplier(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func bounceMultiplierChanger)
{
Debug.Assert(bounceMultiplierChanger != null, "bounceMultiplierChanger cannot be null");
module.bounceMultiplier = bounceMultiplierChanger(module.bounceMultiplier);
@@ -122,7 +181,14 @@ public static CollisionModule SetBounceMultiplier(this CollisionModule module, F
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionColliderForce(this ParticleSystem particleSystem, float colliderForce)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionColliderForce(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float colliderForce)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -134,7 +200,18 @@ public static ParticleSystem SetCollisionColliderForce(this ParticleSystem parti
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionColliderForce(this ParticleSystem particleSystem, Func colliderForceChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionColliderForce(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colliderForceChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(colliderForceChanger != null, "colliderForceChanger cannot be null");
@@ -157,7 +234,11 @@ public static CollisionModule SetColliderForce(this CollisionModule module, floa
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetColliderForce(this CollisionModule module, Func colliderForceChanger)
+ public static CollisionModule SetColliderForce(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colliderForceChanger)
{
Debug.Assert(colliderForceChanger != null, "colliderForceChanger cannot be null");
module.colliderForce = colliderForceChanger(module.colliderForce);
@@ -170,7 +251,14 @@ public static CollisionModule SetColliderForce(this CollisionModule module, Func
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionCollidesWith(this ParticleSystem particleSystem, LayerMask collidesWith)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionCollidesWith(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, LayerMask collidesWith)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -182,7 +270,18 @@ public static ParticleSystem SetCollisionCollidesWith(this ParticleSystem partic
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionCollidesWith(this ParticleSystem particleSystem, Func collidesWithChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionCollidesWith(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func collidesWithChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(collidesWithChanger != null, "collidesWithChanger cannot be null");
@@ -205,7 +304,11 @@ public static CollisionModule SetCollidesWith(this CollisionModule module, Layer
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetCollidesWith(this CollisionModule module, Func collidesWithChanger)
+ public static CollisionModule SetCollidesWith(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func collidesWithChanger)
{
Debug.Assert(collidesWithChanger != null, "collidesWithChanger cannot be null");
module.collidesWith = collidesWithChanger(module.collidesWith);
@@ -218,7 +321,14 @@ public static CollisionModule SetCollidesWith(this CollisionModule module, Func<
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionDampen(this ParticleSystem particleSystem, MinMaxCurve dampen)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionDampen(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve dampen)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -230,7 +340,18 @@ public static ParticleSystem SetCollisionDampen(this ParticleSystem particleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionDampen(this ParticleSystem particleSystem, Func dampenChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionDampen(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func dampenChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(dampenChanger != null, "dampenChanger cannot be null");
@@ -253,7 +374,11 @@ public static CollisionModule SetDampen(this CollisionModule module, MinMaxCurve
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetDampen(this CollisionModule module, Func dampenChanger)
+ public static CollisionModule SetDampen(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func dampenChanger)
{
Debug.Assert(dampenChanger != null, "dampenChanger cannot be null");
module.dampen = dampenChanger(module.dampen);
@@ -266,7 +391,14 @@ public static CollisionModule SetDampen(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionDampenMultiplier(this ParticleSystem particleSystem, float dampenMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionDampenMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float dampenMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -278,7 +410,18 @@ public static ParticleSystem SetCollisionDampenMultiplier(this ParticleSystem pa
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionDampenMultiplier(this ParticleSystem particleSystem, Func dampenMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionDampenMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func dampenMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(dampenMultiplierChanger != null, "dampenMultiplierChanger cannot be null");
@@ -301,7 +444,11 @@ public static CollisionModule SetDampenMultiplier(this CollisionModule module, f
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetDampenMultiplier(this CollisionModule module, Func dampenMultiplierChanger)
+ public static CollisionModule SetDampenMultiplier(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func dampenMultiplierChanger)
{
Debug.Assert(dampenMultiplierChanger != null, "dampenMultiplierChanger cannot be null");
module.dampenMultiplier = dampenMultiplierChanger(module.dampenMultiplier);
@@ -314,7 +461,14 @@ public static CollisionModule SetDampenMultiplier(this CollisionModule module, F
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -326,7 +480,18 @@ public static ParticleSystem SetCollisionEnabled(this ParticleSystem particleSys
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -349,7 +514,11 @@ public static CollisionModule SetEnabled(this CollisionModule module, bool enabl
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetEnabled(this CollisionModule module, Func enabledChanger)
+ public static CollisionModule SetEnabled(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -362,7 +531,14 @@ public static CollisionModule SetEnabled(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnableDynamicColliders(this ParticleSystem particleSystem, bool enableDynamicColliders)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnableDynamicColliders(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enableDynamicColliders)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -374,7 +550,18 @@ public static ParticleSystem SetCollisionEnableDynamicColliders(this ParticleSys
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnableDynamicColliders(this ParticleSystem particleSystem, Func enableDynamicCollidersChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnableDynamicColliders(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enableDynamicCollidersChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enableDynamicCollidersChanger != null, "enableDynamicCollidersChanger cannot be null");
@@ -397,7 +584,11 @@ public static CollisionModule SetEnableDynamicColliders(this CollisionModule mod
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetEnableDynamicColliders(this CollisionModule module, Func enableDynamicCollidersChanger)
+ public static CollisionModule SetEnableDynamicColliders(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enableDynamicCollidersChanger)
{
Debug.Assert(enableDynamicCollidersChanger != null, "enableDynamicCollidersChanger cannot be null");
module.enableDynamicColliders = enableDynamicCollidersChanger(module.enableDynamicColliders);
@@ -413,7 +604,14 @@ public static CollisionModule SetEnableDynamicColliders(this CollisionModule mod
[Obsolete("enableInteriorCollisions property is deprecated and is no longer required and has no effect on the particle system.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnableInteriorCollisions(this ParticleSystem particleSystem, bool enableInteriorCollisions)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnableInteriorCollisions(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enableInteriorCollisions)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -428,7 +626,18 @@ public static ParticleSystem SetCollisionEnableInteriorCollisions(this ParticleS
[Obsolete("enableInteriorCollisions property is deprecated and is no longer required and has no effect on the particle system.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionEnableInteriorCollisions(this ParticleSystem particleSystem, Func enableInteriorCollisionsChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionEnableInteriorCollisions(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enableInteriorCollisionsChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enableInteriorCollisionsChanger != null, "enableInteriorCollisionsChanger cannot be null");
@@ -457,7 +666,11 @@ public static CollisionModule SetEnableInteriorCollisions(this CollisionModule m
[Obsolete("enableInteriorCollisions property is deprecated and is no longer required and has no effect on the particle system.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetEnableInteriorCollisions(this CollisionModule module, Func enableInteriorCollisionsChanger)
+ public static CollisionModule SetEnableInteriorCollisions(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enableInteriorCollisionsChanger)
{
Debug.Assert(enableInteriorCollisionsChanger != null, "enableInteriorCollisionsChanger cannot be null");
module.enableInteriorCollisions = enableInteriorCollisionsChanger(module.enableInteriorCollisions);
@@ -470,7 +683,14 @@ public static CollisionModule SetEnableInteriorCollisions(this CollisionModule m
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionLifetimeLoss(this ParticleSystem particleSystem, MinMaxCurve lifetimeLoss)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionLifetimeLoss(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve lifetimeLoss)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -482,7 +702,18 @@ public static ParticleSystem SetCollisionLifetimeLoss(this ParticleSystem partic
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionLifetimeLoss(this ParticleSystem particleSystem, Func lifetimeLossChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionLifetimeLoss(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func lifetimeLossChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(lifetimeLossChanger != null, "lifetimeLossChanger cannot be null");
@@ -505,7 +736,11 @@ public static CollisionModule SetLifetimeLoss(this CollisionModule module, MinMa
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetLifetimeLoss(this CollisionModule module, Func lifetimeLossChanger)
+ public static CollisionModule SetLifetimeLoss(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func lifetimeLossChanger)
{
Debug.Assert(lifetimeLossChanger != null, "lifetimeLossChanger cannot be null");
module.lifetimeLoss = lifetimeLossChanger(module.lifetimeLoss);
@@ -518,7 +753,14 @@ public static CollisionModule SetLifetimeLoss(this CollisionModule module, Func<
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionLifetimeLossMultiplier(this ParticleSystem particleSystem, float lifetimeLossMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionLifetimeLossMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float lifetimeLossMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -530,7 +772,18 @@ public static ParticleSystem SetCollisionLifetimeLossMultiplier(this ParticleSys
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionLifetimeLossMultiplier(this ParticleSystem particleSystem, Func lifetimeLossMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionLifetimeLossMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func lifetimeLossMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(lifetimeLossMultiplierChanger != null, "lifetimeLossMultiplierChanger cannot be null");
@@ -553,7 +806,11 @@ public static CollisionModule SetLifetimeLossMultiplier(this CollisionModule mod
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetLifetimeLossMultiplier(this CollisionModule module, Func lifetimeLossMultiplierChanger)
+ public static CollisionModule SetLifetimeLossMultiplier(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func lifetimeLossMultiplierChanger)
{
Debug.Assert(lifetimeLossMultiplierChanger != null, "lifetimeLossMultiplierChanger cannot be null");
module.lifetimeLossMultiplier = lifetimeLossMultiplierChanger(module.lifetimeLossMultiplier);
@@ -566,7 +823,14 @@ public static CollisionModule SetLifetimeLossMultiplier(this CollisionModule mod
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMaxCollisionShapes(this ParticleSystem particleSystem, int maxCollisionShapes)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMaxCollisionShapes(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, int maxCollisionShapes)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -578,7 +842,18 @@ public static ParticleSystem SetCollisionMaxCollisionShapes(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMaxCollisionShapes(this ParticleSystem particleSystem, Func maxCollisionShapesChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMaxCollisionShapes(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func maxCollisionShapesChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(maxCollisionShapesChanger != null, "maxCollisionShapesChanger cannot be null");
@@ -601,7 +876,11 @@ public static CollisionModule SetMaxCollisionShapes(this CollisionModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMaxCollisionShapes(this CollisionModule module, Func maxCollisionShapesChanger)
+ public static CollisionModule SetMaxCollisionShapes(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func maxCollisionShapesChanger)
{
Debug.Assert(maxCollisionShapesChanger != null, "maxCollisionShapesChanger cannot be null");
module.maxCollisionShapes = maxCollisionShapesChanger(module.maxCollisionShapes);
@@ -614,7 +893,14 @@ public static CollisionModule SetMaxCollisionShapes(this CollisionModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMaxKillSpeed(this ParticleSystem particleSystem, float maxKillSpeed)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMaxKillSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float maxKillSpeed)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -626,7 +912,18 @@ public static ParticleSystem SetCollisionMaxKillSpeed(this ParticleSystem partic
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMaxKillSpeed(this ParticleSystem particleSystem, Func maxKillSpeedChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMaxKillSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func maxKillSpeedChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(maxKillSpeedChanger != null, "maxKillSpeedChanger cannot be null");
@@ -649,7 +946,11 @@ public static CollisionModule SetMaxKillSpeed(this CollisionModule module, float
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMaxKillSpeed(this CollisionModule module, Func maxKillSpeedChanger)
+ public static CollisionModule SetMaxKillSpeed(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func maxKillSpeedChanger)
{
Debug.Assert(maxKillSpeedChanger != null, "maxKillSpeedChanger cannot be null");
module.maxKillSpeed = maxKillSpeedChanger(module.maxKillSpeed);
@@ -662,7 +963,14 @@ public static CollisionModule SetMaxKillSpeed(this CollisionModule module, Func<
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMinKillSpeed(this ParticleSystem particleSystem, float minKillSpeed)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMinKillSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float minKillSpeed)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -674,7 +982,18 @@ public static ParticleSystem SetCollisionMinKillSpeed(this ParticleSystem partic
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMinKillSpeed(this ParticleSystem particleSystem, Func minKillSpeedChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMinKillSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func minKillSpeedChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(minKillSpeedChanger != null, "minKillSpeedChanger cannot be null");
@@ -697,7 +1016,11 @@ public static CollisionModule SetMinKillSpeed(this CollisionModule module, float
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMinKillSpeed(this CollisionModule module, Func minKillSpeedChanger)
+ public static CollisionModule SetMinKillSpeed(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func minKillSpeedChanger)
{
Debug.Assert(minKillSpeedChanger != null, "minKillSpeedChanger cannot be null");
module.minKillSpeed = minKillSpeedChanger(module.minKillSpeed);
@@ -710,7 +1033,14 @@ public static CollisionModule SetMinKillSpeed(this CollisionModule module, Func<
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMode(this ParticleSystem particleSystem, ParticleSystemCollisionMode mode)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMode(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemCollisionMode mode)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -722,7 +1052,18 @@ public static ParticleSystem SetCollisionMode(this ParticleSystem particleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMode(this ParticleSystem particleSystem, Func modeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMode(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func modeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(modeChanger != null, "modeChanger cannot be null");
@@ -745,7 +1086,11 @@ public static CollisionModule SetMode(this CollisionModule module, ParticleSyste
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMode(this CollisionModule module, Func modeChanger)
+ public static CollisionModule SetMode(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func modeChanger)
{
Debug.Assert(modeChanger != null, "modeChanger cannot be null");
module.mode = modeChanger(module.mode);
@@ -758,7 +1103,14 @@ public static CollisionModule SetMode(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByCollisionAngle(this ParticleSystem particleSystem, bool multiplyColliderForceByCollisionAngle)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByCollisionAngle(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool multiplyColliderForceByCollisionAngle)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -770,7 +1122,18 @@ public static ParticleSystem SetCollisionMultiplyColliderForceByCollisionAngle(t
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByCollisionAngle(this ParticleSystem particleSystem, Func multiplyColliderForceByCollisionAngleChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByCollisionAngle(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByCollisionAngleChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(multiplyColliderForceByCollisionAngleChanger != null, "multiplyColliderForceByCollisionAngleChanger cannot be null");
@@ -793,7 +1156,11 @@ public static CollisionModule SetMultiplyColliderForceByCollisionAngle(this Coll
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMultiplyColliderForceByCollisionAngle(this CollisionModule module, Func multiplyColliderForceByCollisionAngleChanger)
+ public static CollisionModule SetMultiplyColliderForceByCollisionAngle(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByCollisionAngleChanger)
{
Debug.Assert(multiplyColliderForceByCollisionAngleChanger != null, "multiplyColliderForceByCollisionAngleChanger cannot be null");
module.multiplyColliderForceByCollisionAngle = multiplyColliderForceByCollisionAngleChanger(module.multiplyColliderForceByCollisionAngle);
@@ -806,7 +1173,14 @@ public static CollisionModule SetMultiplyColliderForceByCollisionAngle(this Coll
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSize(this ParticleSystem particleSystem, bool multiplyColliderForceByParticleSize)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSize(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool multiplyColliderForceByParticleSize)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -818,7 +1192,18 @@ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSize(thi
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSize(this ParticleSystem particleSystem, Func multiplyColliderForceByParticleSizeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSize(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByParticleSizeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(multiplyColliderForceByParticleSizeChanger != null, "multiplyColliderForceByParticleSizeChanger cannot be null");
@@ -841,7 +1226,11 @@ public static CollisionModule SetMultiplyColliderForceByParticleSize(this Collis
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMultiplyColliderForceByParticleSize(this CollisionModule module, Func multiplyColliderForceByParticleSizeChanger)
+ public static CollisionModule SetMultiplyColliderForceByParticleSize(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByParticleSizeChanger)
{
Debug.Assert(multiplyColliderForceByParticleSizeChanger != null, "multiplyColliderForceByParticleSizeChanger cannot be null");
module.multiplyColliderForceByParticleSize = multiplyColliderForceByParticleSizeChanger(module.multiplyColliderForceByParticleSize);
@@ -854,7 +1243,14 @@ public static CollisionModule SetMultiplyColliderForceByParticleSize(this Collis
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSpeed(this ParticleSystem particleSystem, bool multiplyColliderForceByParticleSpeed)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool multiplyColliderForceByParticleSpeed)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -866,7 +1262,18 @@ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSpeed(th
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSpeed(this ParticleSystem particleSystem, Func multiplyColliderForceByParticleSpeedChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionMultiplyColliderForceByParticleSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByParticleSpeedChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(multiplyColliderForceByParticleSpeedChanger != null, "multiplyColliderForceByParticleSpeedChanger cannot be null");
@@ -889,7 +1296,11 @@ public static CollisionModule SetMultiplyColliderForceByParticleSpeed(this Colli
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetMultiplyColliderForceByParticleSpeed(this CollisionModule module, Func multiplyColliderForceByParticleSpeedChanger)
+ public static CollisionModule SetMultiplyColliderForceByParticleSpeed(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplyColliderForceByParticleSpeedChanger)
{
Debug.Assert(multiplyColliderForceByParticleSpeedChanger != null, "multiplyColliderForceByParticleSpeedChanger cannot be null");
module.multiplyColliderForceByParticleSpeed = multiplyColliderForceByParticleSpeedChanger(module.multiplyColliderForceByParticleSpeed);
@@ -902,7 +1313,14 @@ public static CollisionModule SetMultiplyColliderForceByParticleSpeed(this Colli
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionQuality(this ParticleSystem particleSystem, ParticleSystemCollisionQuality quality)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionQuality(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemCollisionQuality quality)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -914,7 +1332,18 @@ public static ParticleSystem SetCollisionQuality(this ParticleSystem particleSys
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionQuality(this ParticleSystem particleSystem, Func qualityChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionQuality(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func qualityChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(qualityChanger != null, "qualityChanger cannot be null");
@@ -937,7 +1366,11 @@ public static CollisionModule SetQuality(this CollisionModule module, ParticleSy
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetQuality(this CollisionModule module, Func qualityChanger)
+ public static CollisionModule SetQuality(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func qualityChanger)
{
Debug.Assert(qualityChanger != null, "qualityChanger cannot be null");
module.quality = qualityChanger(module.quality);
@@ -950,7 +1383,14 @@ public static CollisionModule SetQuality(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionRadiusScale(this ParticleSystem particleSystem, float radiusScale)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionRadiusScale(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float radiusScale)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -962,7 +1402,18 @@ public static ParticleSystem SetCollisionRadiusScale(this ParticleSystem particl
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionRadiusScale(this ParticleSystem particleSystem, Func radiusScaleChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionRadiusScale(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func radiusScaleChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(radiusScaleChanger != null, "radiusScaleChanger cannot be null");
@@ -985,7 +1436,11 @@ public static CollisionModule SetRadiusScale(this CollisionModule module, float
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetRadiusScale(this CollisionModule module, Func radiusScaleChanger)
+ public static CollisionModule SetRadiusScale(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func radiusScaleChanger)
{
Debug.Assert(radiusScaleChanger != null, "radiusScaleChanger cannot be null");
module.radiusScale = radiusScaleChanger(module.radiusScale);
@@ -998,7 +1453,14 @@ public static CollisionModule SetRadiusScale(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionSendCollisionMessages(this ParticleSystem particleSystem, bool sendCollisionMessages)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionSendCollisionMessages(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool sendCollisionMessages)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -1010,7 +1472,18 @@ public static ParticleSystem SetCollisionSendCollisionMessages(this ParticleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionSendCollisionMessages(this ParticleSystem particleSystem, Func sendCollisionMessagesChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionSendCollisionMessages(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func sendCollisionMessagesChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(sendCollisionMessagesChanger != null, "sendCollisionMessagesChanger cannot be null");
@@ -1033,7 +1506,11 @@ public static CollisionModule SetSendCollisionMessages(this CollisionModule modu
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetSendCollisionMessages(this CollisionModule module, Func sendCollisionMessagesChanger)
+ public static CollisionModule SetSendCollisionMessages(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func sendCollisionMessagesChanger)
{
Debug.Assert(sendCollisionMessagesChanger != null, "sendCollisionMessagesChanger cannot be null");
module.sendCollisionMessages = sendCollisionMessagesChanger(module.sendCollisionMessages);
@@ -1046,7 +1523,14 @@ public static CollisionModule SetSendCollisionMessages(this CollisionModule modu
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionType(this ParticleSystem particleSystem, ParticleSystemCollisionType type)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionType(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemCollisionType type)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -1058,7 +1542,18 @@ public static ParticleSystem SetCollisionType(this ParticleSystem particleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionType(this ParticleSystem particleSystem, Func typeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionType(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func typeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(typeChanger != null, "typeChanger cannot be null");
@@ -1081,7 +1576,11 @@ public static CollisionModule SetType(this CollisionModule module, ParticleSyste
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetType(this CollisionModule module, Func typeChanger)
+ public static CollisionModule SetType(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func typeChanger)
{
Debug.Assert(typeChanger != null, "typeChanger cannot be null");
module.type = typeChanger(module.type);
@@ -1094,7 +1593,14 @@ public static CollisionModule SetType(this CollisionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionVoxelSize(this ParticleSystem particleSystem, float voxelSize)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionVoxelSize(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float voxelSize)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.collision;
@@ -1106,7 +1612,18 @@ public static ParticleSystem SetCollisionVoxelSize(this ParticleSystem particleS
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCollisionVoxelSize(this ParticleSystem particleSystem, Func voxelSizeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCollisionVoxelSize(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func voxelSizeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(voxelSizeChanger != null, "voxelSizeChanger cannot be null");
@@ -1129,7 +1646,11 @@ public static CollisionModule SetVoxelSize(this CollisionModule module, float vo
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CollisionModule SetVoxelSize(this CollisionModule module, Func voxelSizeChanger)
+ public static CollisionModule SetVoxelSize(this CollisionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func voxelSizeChanger)
{
Debug.Assert(voxelSizeChanger != null, "voxelSizeChanger cannot be null");
module.voxelSize = voxelSizeChanger(module.voxelSize);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CollisionModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/CollisionModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CollisionModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/CollisionModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/ColorBySpeedModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/ColorBySpeedModuleExtension.cs
similarity index 69%
rename from Packages/FluentParticleSystem/Runtime/Nullable/Extensions/ColorBySpeedModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/ColorBySpeedModuleExtension.cs
index 1007c90..339fdb9 100644
--- a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/ColorBySpeedModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/ColorBySpeedModuleExtension.cs
@@ -1,9 +1,13 @@
-#nullable enable
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class ColorBySpeedModuleExtension
@@ -13,7 +17,18 @@ public static class ColorBySpeedModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditColorBySpeed(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditColorBySpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -26,7 +41,14 @@ public static ParticleSystem EditColorBySpeed(this ParticleSystem particleSystem
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedColor(this ParticleSystem particleSystem, MinMaxGradient color)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedColor(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxGradient color)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.colorBySpeed;
@@ -38,7 +60,18 @@ public static ParticleSystem SetColorBySpeedColor(this ParticleSystem particleSy
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedColor(this ParticleSystem particleSystem, Func colorChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedColor(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colorChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(colorChanger != null, "colorChanger cannot be null");
@@ -61,7 +94,11 @@ public static ColorBySpeedModule SetColor(this ColorBySpeedModule module, MinMax
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ColorBySpeedModule SetColor(this ColorBySpeedModule module, Func colorChanger)
+ public static ColorBySpeedModule SetColor(this ColorBySpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colorChanger)
{
Debug.Assert(colorChanger != null, "colorChanger cannot be null");
module.color = colorChanger(module.color);
@@ -74,7 +111,14 @@ public static ColorBySpeedModule SetColor(this ColorBySpeedModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.colorBySpeed;
@@ -86,7 +130,18 @@ public static ParticleSystem SetColorBySpeedEnabled(this ParticleSystem particle
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -109,7 +164,11 @@ public static ColorBySpeedModule SetEnabled(this ColorBySpeedModule module, bool
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ColorBySpeedModule SetEnabled(this ColorBySpeedModule module, Func enabledChanger)
+ public static ColorBySpeedModule SetEnabled(this ColorBySpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -122,7 +181,14 @@ public static ColorBySpeedModule SetEnabled(this ColorBySpeedModule module, Func
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedRange(this ParticleSystem particleSystem, Vector2 range)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedRange(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, Vector2 range)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.colorBySpeed;
@@ -134,7 +200,18 @@ public static ParticleSystem SetColorBySpeedRange(this ParticleSystem particleSy
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorBySpeedRange(this ParticleSystem particleSystem, Func rangeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorBySpeedRange(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rangeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rangeChanger != null, "rangeChanger cannot be null");
@@ -157,7 +234,11 @@ public static ColorBySpeedModule SetRange(this ColorBySpeedModule module, Vector
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ColorBySpeedModule SetRange(this ColorBySpeedModule module, Func rangeChanger)
+ public static ColorBySpeedModule SetRange(this ColorBySpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rangeChanger)
{
Debug.Assert(rangeChanger != null, "rangeChanger cannot be null");
module.range = rangeChanger(module.range);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorBySpeedModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/ColorBySpeedModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorBySpeedModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/ColorBySpeedModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorOverLifetimeModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/ColorOverLifetimeModuleExtension.cs
similarity index 70%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorOverLifetimeModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/ColorOverLifetimeModuleExtension.cs
index 4202d7a..9a599e3 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorOverLifetimeModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/ColorOverLifetimeModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class ColorOverLifetimeModuleExtension
@@ -12,7 +17,18 @@ public static class ColorOverLifetimeModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditColorOverLifetime(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditColorOverLifetime(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditColorOverLifetime(this ParticleSystem particleS
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorOverLifetimeColor(this ParticleSystem particleSystem, MinMaxGradient color)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorOverLifetimeColor(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxGradient color)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.colorOverLifetime;
@@ -37,7 +60,18 @@ public static ParticleSystem SetColorOverLifetimeColor(this ParticleSystem parti
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorOverLifetimeColor(this ParticleSystem particleSystem, Func colorChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorOverLifetimeColor(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colorChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(colorChanger != null, "colorChanger cannot be null");
@@ -60,7 +94,11 @@ public static ColorOverLifetimeModule SetColor(this ColorOverLifetimeModule modu
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ColorOverLifetimeModule SetColor(this ColorOverLifetimeModule module, Func colorChanger)
+ public static ColorOverLifetimeModule SetColor(this ColorOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func colorChanger)
{
Debug.Assert(colorChanger != null, "colorChanger cannot be null");
module.color = colorChanger(module.color);
@@ -73,7 +111,14 @@ public static ColorOverLifetimeModule SetColor(this ColorOverLifetimeModule modu
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorOverLifetimeEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorOverLifetimeEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.colorOverLifetime;
@@ -85,7 +130,18 @@ public static ParticleSystem SetColorOverLifetimeEnabled(this ParticleSystem par
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetColorOverLifetimeEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetColorOverLifetimeEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -108,7 +164,11 @@ public static ColorOverLifetimeModule SetEnabled(this ColorOverLifetimeModule mo
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ColorOverLifetimeModule SetEnabled(this ColorOverLifetimeModule module, Func enabledChanger)
+ public static ColorOverLifetimeModule SetEnabled(this ColorOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorOverLifetimeModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/ColorOverLifetimeModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ColorOverLifetimeModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/ColorOverLifetimeModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CustomDataModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/CustomDataModuleExtension.cs
similarity index 68%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CustomDataModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/CustomDataModuleExtension.cs
index c6d7763..5c8eb6f 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CustomDataModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/CustomDataModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class CustomDataModuleExtension
@@ -12,7 +17,18 @@ public static class CustomDataModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditCustomData(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditCustomData(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditCustomData(this ParticleSystem particleSystem,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCustomDataEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCustomDataEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.customData;
@@ -37,7 +60,18 @@ public static ParticleSystem SetCustomDataEnabled(this ParticleSystem particleSy
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetCustomDataEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetCustomDataEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -60,7 +94,11 @@ public static CustomDataModule SetEnabled(this CustomDataModule module, bool ena
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static CustomDataModule SetEnabled(this CustomDataModule module, Func enabledChanger)
+ public static CustomDataModule SetEnabled(this CustomDataModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CustomDataModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/CustomDataModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/CustomDataModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/CustomDataModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/EmissionModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/EmissionModuleExtension.cs
similarity index 74%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/EmissionModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/EmissionModuleExtension.cs
index c37d6cd..478cb14 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/EmissionModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/EmissionModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class EmissionModuleExtension
@@ -12,7 +17,18 @@ public static class EmissionModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditEmission(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditEmission(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditEmission(this ParticleSystem particleSystem, Ac
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionBurstCount(this ParticleSystem particleSystem, int burstCount)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionBurstCount(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, int burstCount)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -37,7 +60,18 @@ public static ParticleSystem SetEmissionBurstCount(this ParticleSystem particleS
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionBurstCount(this ParticleSystem particleSystem, Func burstCountChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionBurstCount(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func burstCountChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(burstCountChanger != null, "burstCountChanger cannot be null");
@@ -60,7 +94,11 @@ public static EmissionModule SetBurstCount(this EmissionModule module, int burst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetBurstCount(this EmissionModule module, Func burstCountChanger)
+ public static EmissionModule SetBurstCount(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func burstCountChanger)
{
Debug.Assert(burstCountChanger != null, "burstCountChanger cannot be null");
module.burstCount = burstCountChanger(module.burstCount);
@@ -73,7 +111,14 @@ public static EmissionModule SetBurstCount(this EmissionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -85,7 +130,18 @@ public static ParticleSystem SetEmissionEnabled(this ParticleSystem particleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -108,7 +164,11 @@ public static EmissionModule SetEnabled(this EmissionModule module, bool enabled
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetEnabled(this EmissionModule module, Func enabledChanger)
+ public static EmissionModule SetEnabled(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -124,7 +184,14 @@ public static EmissionModule SetEnabled(this EmissionModule module, Func rateChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRate(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateChanger != null, "rateChanger cannot be null");
@@ -168,7 +246,11 @@ public static EmissionModule SetRate(this EmissionModule module, MinMaxCurve rat
[Obsolete("rate property is deprecated. Use rateOverTime or rateOverDistance instead.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRate(this EmissionModule module, Func rateChanger)
+ public static EmissionModule SetRate(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateChanger)
{
Debug.Assert(rateChanger != null, "rateChanger cannot be null");
module.rate = rateChanger(module.rate);
@@ -184,7 +266,14 @@ public static EmissionModule SetRate(this EmissionModule module, Func rateMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateMultiplierChanger != null, "rateMultiplierChanger cannot be null");
@@ -228,7 +328,11 @@ public static EmissionModule SetRateMultiplier(this EmissionModule module, float
[Obsolete("rateMultiplier property is deprecated. Use rateOverTimeMultiplier or rateOverDistanceMultiplier instead.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRateMultiplier(this EmissionModule module, Func rateMultiplierChanger)
+ public static EmissionModule SetRateMultiplier(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateMultiplierChanger)
{
Debug.Assert(rateMultiplierChanger != null, "rateMultiplierChanger cannot be null");
module.rateMultiplier = rateMultiplierChanger(module.rateMultiplier);
@@ -241,7 +345,14 @@ public static EmissionModule SetRateMultiplier(this EmissionModule module, Func<
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverDistance(this ParticleSystem particleSystem, MinMaxCurve rateOverDistance)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverDistance(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve rateOverDistance)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -253,7 +364,18 @@ public static ParticleSystem SetEmissionRateOverDistance(this ParticleSystem par
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverDistance(this ParticleSystem particleSystem, Func rateOverDistanceChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverDistance(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverDistanceChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateOverDistanceChanger != null, "rateOverDistanceChanger cannot be null");
@@ -276,7 +398,11 @@ public static EmissionModule SetRateOverDistance(this EmissionModule module, Min
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRateOverDistance(this EmissionModule module, Func rateOverDistanceChanger)
+ public static EmissionModule SetRateOverDistance(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverDistanceChanger)
{
Debug.Assert(rateOverDistanceChanger != null, "rateOverDistanceChanger cannot be null");
module.rateOverDistance = rateOverDistanceChanger(module.rateOverDistance);
@@ -289,7 +415,14 @@ public static EmissionModule SetRateOverDistance(this EmissionModule module, Fun
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverDistanceMultiplier(this ParticleSystem particleSystem, float rateOverDistanceMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverDistanceMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float rateOverDistanceMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -301,7 +434,18 @@ public static ParticleSystem SetEmissionRateOverDistanceMultiplier(this Particle
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverDistanceMultiplier(this ParticleSystem particleSystem, Func rateOverDistanceMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverDistanceMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverDistanceMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateOverDistanceMultiplierChanger != null, "rateOverDistanceMultiplierChanger cannot be null");
@@ -324,7 +468,11 @@ public static EmissionModule SetRateOverDistanceMultiplier(this EmissionModule m
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRateOverDistanceMultiplier(this EmissionModule module, Func rateOverDistanceMultiplierChanger)
+ public static EmissionModule SetRateOverDistanceMultiplier(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverDistanceMultiplierChanger)
{
Debug.Assert(rateOverDistanceMultiplierChanger != null, "rateOverDistanceMultiplierChanger cannot be null");
module.rateOverDistanceMultiplier = rateOverDistanceMultiplierChanger(module.rateOverDistanceMultiplier);
@@ -337,7 +485,14 @@ public static EmissionModule SetRateOverDistanceMultiplier(this EmissionModule m
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverTime(this ParticleSystem particleSystem, MinMaxCurve rateOverTime)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverTime(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve rateOverTime)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -349,7 +504,18 @@ public static ParticleSystem SetEmissionRateOverTime(this ParticleSystem particl
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverTime(this ParticleSystem particleSystem, Func rateOverTimeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverTime(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverTimeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateOverTimeChanger != null, "rateOverTimeChanger cannot be null");
@@ -372,7 +538,11 @@ public static EmissionModule SetRateOverTime(this EmissionModule module, MinMaxC
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRateOverTime(this EmissionModule module, Func rateOverTimeChanger)
+ public static EmissionModule SetRateOverTime(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverTimeChanger)
{
Debug.Assert(rateOverTimeChanger != null, "rateOverTimeChanger cannot be null");
module.rateOverTime = rateOverTimeChanger(module.rateOverTime);
@@ -385,7 +555,14 @@ public static EmissionModule SetRateOverTime(this EmissionModule module, Func
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverTimeMultiplier(this ParticleSystem particleSystem, float rateOverTimeMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverTimeMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float rateOverTimeMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -397,7 +574,18 @@ public static ParticleSystem SetEmissionRateOverTimeMultiplier(this ParticleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionRateOverTimeMultiplier(this ParticleSystem particleSystem, Func rateOverTimeMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionRateOverTimeMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverTimeMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(rateOverTimeMultiplierChanger != null, "rateOverTimeMultiplierChanger cannot be null");
@@ -420,7 +608,11 @@ public static EmissionModule SetRateOverTimeMultiplier(this EmissionModule modul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetRateOverTimeMultiplier(this EmissionModule module, Func rateOverTimeMultiplierChanger)
+ public static EmissionModule SetRateOverTimeMultiplier(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func rateOverTimeMultiplierChanger)
{
Debug.Assert(rateOverTimeMultiplierChanger != null, "rateOverTimeMultiplierChanger cannot be null");
module.rateOverTimeMultiplier = rateOverTimeMultiplierChanger(module.rateOverTimeMultiplier);
@@ -436,7 +628,14 @@ public static EmissionModule SetRateOverTimeMultiplier(this EmissionModule modul
[Obsolete("ParticleSystemEmissionType no longer does anything. Time and Distance based emission are now both always active.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionType(this ParticleSystem particleSystem, ParticleSystemEmissionType type)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionType(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemEmissionType type)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.emission;
@@ -451,7 +650,18 @@ public static ParticleSystem SetEmissionType(this ParticleSystem particleSystem,
[Obsolete("ParticleSystemEmissionType no longer does anything. Time and Distance based emission are now both always active.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetEmissionType(this ParticleSystem particleSystem, Func typeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetEmissionType(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func typeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(typeChanger != null, "typeChanger cannot be null");
@@ -480,7 +690,11 @@ public static EmissionModule SetType(this EmissionModule module, ParticleSystemE
[Obsolete("ParticleSystemEmissionType no longer does anything. Time and Distance based emission are now both always active.", false)]
#endif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static EmissionModule SetType(this EmissionModule module, Func typeChanger)
+ public static EmissionModule SetType(this EmissionModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func typeChanger)
{
Debug.Assert(typeChanger != null, "typeChanger cannot be null");
module.type = typeChanger(module.type);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/EmissionModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/EmissionModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/EmissionModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/EmissionModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ExternalForcesModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/ExternalForcesModuleExtension.cs
similarity index 73%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ExternalForcesModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/ExternalForcesModuleExtension.cs
index ef06c58..b38af6d 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ExternalForcesModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/ExternalForcesModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class ExternalForcesModuleExtension
@@ -12,7 +17,18 @@ public static class ExternalForcesModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditExternalForces(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditExternalForces(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditExternalForces(this ParticleSystem particleSyst
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.externalForces;
@@ -37,7 +60,18 @@ public static ParticleSystem SetExternalForcesEnabled(this ParticleSystem partic
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -60,7 +94,11 @@ public static ExternalForcesModule SetEnabled(this ExternalForcesModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ExternalForcesModule SetEnabled(this ExternalForcesModule module, Func enabledChanger)
+ public static ExternalForcesModule SetEnabled(this ExternalForcesModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -73,7 +111,14 @@ public static ExternalForcesModule SetEnabled(this ExternalForcesModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesInfluenceFilter(this ParticleSystem particleSystem, ParticleSystemGameObjectFilter influenceFilter)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesInfluenceFilter(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemGameObjectFilter influenceFilter)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.externalForces;
@@ -85,7 +130,18 @@ public static ParticleSystem SetExternalForcesInfluenceFilter(this ParticleSyste
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesInfluenceFilter(this ParticleSystem particleSystem, Func influenceFilterChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesInfluenceFilter(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func influenceFilterChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(influenceFilterChanger != null, "influenceFilterChanger cannot be null");
@@ -108,7 +164,11 @@ public static ExternalForcesModule SetInfluenceFilter(this ExternalForcesModule
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ExternalForcesModule SetInfluenceFilter(this ExternalForcesModule module, Func influenceFilterChanger)
+ public static ExternalForcesModule SetInfluenceFilter(this ExternalForcesModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func influenceFilterChanger)
{
Debug.Assert(influenceFilterChanger != null, "influenceFilterChanger cannot be null");
module.influenceFilter = influenceFilterChanger(module.influenceFilter);
@@ -123,7 +183,14 @@ public static ExternalForcesModule SetInfluenceFilter(this ExternalForcesModule
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesInfluenceMask(this ParticleSystem particleSystem, LayerMask influenceMask)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesInfluenceMask(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, LayerMask influenceMask)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.externalForces;
@@ -135,7 +202,18 @@ public static ParticleSystem SetExternalForcesInfluenceMask(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesInfluenceMask(this ParticleSystem particleSystem, Func influenceMaskChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesInfluenceMask(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func influenceMaskChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(influenceMaskChanger != null, "influenceMaskChanger cannot be null");
@@ -158,7 +236,11 @@ public static ExternalForcesModule SetInfluenceMask(this ExternalForcesModule mo
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ExternalForcesModule SetInfluenceMask(this ExternalForcesModule module, Func influenceMaskChanger)
+ public static ExternalForcesModule SetInfluenceMask(this ExternalForcesModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func influenceMaskChanger)
{
Debug.Assert(influenceMaskChanger != null, "influenceMaskChanger cannot be null");
module.influenceMask = influenceMaskChanger(module.influenceMask);
@@ -173,7 +255,14 @@ public static ExternalForcesModule SetInfluenceMask(this ExternalForcesModule mo
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesMultiplier(this ParticleSystem particleSystem, float multiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float multiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.externalForces;
@@ -185,7 +274,18 @@ public static ParticleSystem SetExternalForcesMultiplier(this ParticleSystem par
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesMultiplier(this ParticleSystem particleSystem, Func multiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(multiplierChanger != null, "multiplierChanger cannot be null");
@@ -208,7 +308,11 @@ public static ExternalForcesModule SetMultiplier(this ExternalForcesModule modul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ExternalForcesModule SetMultiplier(this ExternalForcesModule module, Func multiplierChanger)
+ public static ExternalForcesModule SetMultiplier(this ExternalForcesModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplierChanger)
{
Debug.Assert(multiplierChanger != null, "multiplierChanger cannot be null");
module.multiplier = multiplierChanger(module.multiplier);
@@ -223,7 +327,14 @@ public static ExternalForcesModule SetMultiplier(this ExternalForcesModule modul
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesMultiplierCurve(this ParticleSystem particleSystem, MinMaxCurve multiplierCurve)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesMultiplierCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve multiplierCurve)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.externalForces;
@@ -235,7 +346,18 @@ public static ParticleSystem SetExternalForcesMultiplierCurve(this ParticleSyste
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetExternalForcesMultiplierCurve(this ParticleSystem particleSystem, Func multiplierCurveChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetExternalForcesMultiplierCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplierCurveChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(multiplierCurveChanger != null, "multiplierCurveChanger cannot be null");
@@ -258,7 +380,11 @@ public static ExternalForcesModule SetMultiplierCurve(this ExternalForcesModule
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ExternalForcesModule SetMultiplierCurve(this ExternalForcesModule module, Func multiplierCurveChanger)
+ public static ExternalForcesModule SetMultiplierCurve(this ExternalForcesModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func multiplierCurveChanger)
{
Debug.Assert(multiplierCurveChanger != null, "multiplierCurveChanger cannot be null");
module.multiplierCurve = multiplierCurveChanger(module.multiplierCurve);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ExternalForcesModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/ExternalForcesModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ExternalForcesModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/ExternalForcesModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ForceOverLifetimeModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/ForceOverLifetimeModuleExtension.cs
similarity index 72%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ForceOverLifetimeModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/ForceOverLifetimeModuleExtension.cs
index b964220..6f69fc0 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ForceOverLifetimeModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/ForceOverLifetimeModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class ForceOverLifetimeModuleExtension
@@ -12,7 +17,18 @@ public static class ForceOverLifetimeModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditForceOverLifetime(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditForceOverLifetime(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditForceOverLifetime(this ParticleSystem particleS
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -37,7 +60,18 @@ public static ParticleSystem SetForceOverLifetimeEnabled(this ParticleSystem par
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -60,7 +94,11 @@ public static ForceOverLifetimeModule SetEnabled(this ForceOverLifetimeModule mo
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetEnabled(this ForceOverLifetimeModule module, Func enabledChanger)
+ public static ForceOverLifetimeModule SetEnabled(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -73,7 +111,14 @@ public static ForceOverLifetimeModule SetEnabled(this ForceOverLifetimeModule mo
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeRandomized(this ParticleSystem particleSystem, bool randomized)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeRandomized(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool randomized)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -85,7 +130,18 @@ public static ParticleSystem SetForceOverLifetimeRandomized(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeRandomized(this ParticleSystem particleSystem, Func randomizedChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeRandomized(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func randomizedChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(randomizedChanger != null, "randomizedChanger cannot be null");
@@ -108,7 +164,11 @@ public static ForceOverLifetimeModule SetRandomized(this ForceOverLifetimeModule
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetRandomized(this ForceOverLifetimeModule module, Func randomizedChanger)
+ public static ForceOverLifetimeModule SetRandomized(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func randomizedChanger)
{
Debug.Assert(randomizedChanger != null, "randomizedChanger cannot be null");
module.randomized = randomizedChanger(module.randomized);
@@ -121,7 +181,14 @@ public static ForceOverLifetimeModule SetRandomized(this ForceOverLifetimeModule
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeSpace(this ParticleSystem particleSystem, ParticleSystemSimulationSpace space)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeSpace(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemSimulationSpace space)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -133,7 +200,18 @@ public static ParticleSystem SetForceOverLifetimeSpace(this ParticleSystem parti
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeSpace(this ParticleSystem particleSystem, Func spaceChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeSpace(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func spaceChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(spaceChanger != null, "spaceChanger cannot be null");
@@ -156,7 +234,11 @@ public static ForceOverLifetimeModule SetSpace(this ForceOverLifetimeModule modu
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetSpace(this ForceOverLifetimeModule module, Func spaceChanger)
+ public static ForceOverLifetimeModule SetSpace(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func spaceChanger)
{
Debug.Assert(spaceChanger != null, "spaceChanger cannot be null");
module.space = spaceChanger(module.space);
@@ -169,7 +251,14 @@ public static ForceOverLifetimeModule SetSpace(this ForceOverLifetimeModule modu
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeX(this ParticleSystem particleSystem, MinMaxCurve x)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeX(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve x)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -181,7 +270,18 @@ public static ParticleSystem SetForceOverLifetimeX(this ParticleSystem particleS
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeX(this ParticleSystem particleSystem, Func xChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeX(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func xChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(xChanger != null, "xChanger cannot be null");
@@ -204,7 +304,11 @@ public static ForceOverLifetimeModule SetX(this ForceOverLifetimeModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetX(this ForceOverLifetimeModule module, Func xChanger)
+ public static ForceOverLifetimeModule SetX(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func xChanger)
{
Debug.Assert(xChanger != null, "xChanger cannot be null");
module.x = xChanger(module.x);
@@ -217,7 +321,14 @@ public static ForceOverLifetimeModule SetX(this ForceOverLifetimeModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeXMultiplier(this ParticleSystem particleSystem, float xMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeXMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float xMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -229,7 +340,18 @@ public static ParticleSystem SetForceOverLifetimeXMultiplier(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeXMultiplier(this ParticleSystem particleSystem, Func xMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeXMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func xMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(xMultiplierChanger != null, "xMultiplierChanger cannot be null");
@@ -252,7 +374,11 @@ public static ForceOverLifetimeModule SetXMultiplier(this ForceOverLifetimeModul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetXMultiplier(this ForceOverLifetimeModule module, Func xMultiplierChanger)
+ public static ForceOverLifetimeModule SetXMultiplier(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func xMultiplierChanger)
{
Debug.Assert(xMultiplierChanger != null, "xMultiplierChanger cannot be null");
module.xMultiplier = xMultiplierChanger(module.xMultiplier);
@@ -265,7 +391,14 @@ public static ForceOverLifetimeModule SetXMultiplier(this ForceOverLifetimeModul
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeY(this ParticleSystem particleSystem, MinMaxCurve y)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeY(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve y)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -277,7 +410,18 @@ public static ParticleSystem SetForceOverLifetimeY(this ParticleSystem particleS
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeY(this ParticleSystem particleSystem, Func yChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeY(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func yChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(yChanger != null, "yChanger cannot be null");
@@ -300,7 +444,11 @@ public static ForceOverLifetimeModule SetY(this ForceOverLifetimeModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetY(this ForceOverLifetimeModule module, Func yChanger)
+ public static ForceOverLifetimeModule SetY(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func yChanger)
{
Debug.Assert(yChanger != null, "yChanger cannot be null");
module.y = yChanger(module.y);
@@ -313,7 +461,14 @@ public static ForceOverLifetimeModule SetY(this ForceOverLifetimeModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeYMultiplier(this ParticleSystem particleSystem, float yMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeYMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float yMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -325,7 +480,18 @@ public static ParticleSystem SetForceOverLifetimeYMultiplier(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeYMultiplier(this ParticleSystem particleSystem, Func yMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeYMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func yMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(yMultiplierChanger != null, "yMultiplierChanger cannot be null");
@@ -348,7 +514,11 @@ public static ForceOverLifetimeModule SetYMultiplier(this ForceOverLifetimeModul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetYMultiplier(this ForceOverLifetimeModule module, Func yMultiplierChanger)
+ public static ForceOverLifetimeModule SetYMultiplier(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func yMultiplierChanger)
{
Debug.Assert(yMultiplierChanger != null, "yMultiplierChanger cannot be null");
module.yMultiplier = yMultiplierChanger(module.yMultiplier);
@@ -361,7 +531,14 @@ public static ForceOverLifetimeModule SetYMultiplier(this ForceOverLifetimeModul
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeZ(this ParticleSystem particleSystem, MinMaxCurve z)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeZ(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve z)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -373,7 +550,18 @@ public static ParticleSystem SetForceOverLifetimeZ(this ParticleSystem particleS
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeZ(this ParticleSystem particleSystem, Func zChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeZ(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func zChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(zChanger != null, "zChanger cannot be null");
@@ -396,7 +584,11 @@ public static ForceOverLifetimeModule SetZ(this ForceOverLifetimeModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetZ(this ForceOverLifetimeModule module, Func zChanger)
+ public static ForceOverLifetimeModule SetZ(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func zChanger)
{
Debug.Assert(zChanger != null, "zChanger cannot be null");
module.z = zChanger(module.z);
@@ -409,7 +601,14 @@ public static ForceOverLifetimeModule SetZ(this ForceOverLifetimeModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeZMultiplier(this ParticleSystem particleSystem, float zMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeZMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float zMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.forceOverLifetime;
@@ -421,7 +620,18 @@ public static ParticleSystem SetForceOverLifetimeZMultiplier(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetForceOverLifetimeZMultiplier(this ParticleSystem particleSystem, Func zMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetForceOverLifetimeZMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func zMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(zMultiplierChanger != null, "zMultiplierChanger cannot be null");
@@ -444,7 +654,11 @@ public static ForceOverLifetimeModule SetZMultiplier(this ForceOverLifetimeModul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ForceOverLifetimeModule SetZMultiplier(this ForceOverLifetimeModule module, Func zMultiplierChanger)
+ public static ForceOverLifetimeModule SetZMultiplier(this ForceOverLifetimeModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func zMultiplierChanger)
{
Debug.Assert(zMultiplierChanger != null, "zMultiplierChanger cannot be null");
module.zMultiplier = zMultiplierChanger(module.zMultiplier);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ForceOverLifetimeModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/ForceOverLifetimeModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/ForceOverLifetimeModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/ForceOverLifetimeModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/InheritVelocityModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/InheritVelocityModuleExtension.cs
similarity index 70%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/InheritVelocityModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/InheritVelocityModuleExtension.cs
index c363651..9c5e30e 100644
--- a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/InheritVelocityModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/InheritVelocityModuleExtension.cs
@@ -1,8 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class InheritVelocityModuleExtension
@@ -12,7 +17,18 @@ public static class InheritVelocityModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditInheritVelocity(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditInheritVelocity(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -25,7 +41,14 @@ public static ParticleSystem EditInheritVelocity(this ParticleSystem particleSys
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityCurve(this ParticleSystem particleSystem, MinMaxCurve curve)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve curve)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.inheritVelocity;
@@ -37,7 +60,18 @@ public static ParticleSystem SetInheritVelocityCurve(this ParticleSystem particl
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityCurve(this ParticleSystem particleSystem, Func curveChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(curveChanger != null, "curveChanger cannot be null");
@@ -60,7 +94,11 @@ public static InheritVelocityModule SetCurve(this InheritVelocityModule module,
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static InheritVelocityModule SetCurve(this InheritVelocityModule module, Func curveChanger)
+ public static InheritVelocityModule SetCurve(this InheritVelocityModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveChanger)
{
Debug.Assert(curveChanger != null, "curveChanger cannot be null");
module.curve = curveChanger(module.curve);
@@ -73,7 +111,14 @@ public static InheritVelocityModule SetCurve(this InheritVelocityModule module,
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityCurveMultiplier(this ParticleSystem particleSystem, float curveMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityCurveMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float curveMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.inheritVelocity;
@@ -85,7 +130,18 @@ public static ParticleSystem SetInheritVelocityCurveMultiplier(this ParticleSyst
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityCurveMultiplier(this ParticleSystem particleSystem, Func curveMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityCurveMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(curveMultiplierChanger != null, "curveMultiplierChanger cannot be null");
@@ -108,7 +164,11 @@ public static InheritVelocityModule SetCurveMultiplier(this InheritVelocityModul
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static InheritVelocityModule SetCurveMultiplier(this InheritVelocityModule module, Func curveMultiplierChanger)
+ public static InheritVelocityModule SetCurveMultiplier(this InheritVelocityModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveMultiplierChanger)
{
Debug.Assert(curveMultiplierChanger != null, "curveMultiplierChanger cannot be null");
module.curveMultiplier = curveMultiplierChanger(module.curveMultiplier);
@@ -121,7 +181,14 @@ public static InheritVelocityModule SetCurveMultiplier(this InheritVelocityModul
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.inheritVelocity;
@@ -133,7 +200,18 @@ public static ParticleSystem SetInheritVelocityEnabled(this ParticleSystem parti
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -156,7 +234,11 @@ public static InheritVelocityModule SetEnabled(this InheritVelocityModule module
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static InheritVelocityModule SetEnabled(this InheritVelocityModule module, Func enabledChanger)
+ public static InheritVelocityModule SetEnabled(this InheritVelocityModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -169,7 +251,14 @@ public static InheritVelocityModule SetEnabled(this InheritVelocityModule module
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityMode(this ParticleSystem particleSystem, ParticleSystemInheritVelocityMode mode)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityMode(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, ParticleSystemInheritVelocityMode mode)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.inheritVelocity;
@@ -181,7 +270,18 @@ public static ParticleSystem SetInheritVelocityMode(this ParticleSystem particle
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetInheritVelocityMode(this ParticleSystem particleSystem, Func modeChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetInheritVelocityMode(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func modeChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(modeChanger != null, "modeChanger cannot be null");
@@ -204,7 +304,11 @@ public static InheritVelocityModule SetMode(this InheritVelocityModule module, P
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static InheritVelocityModule SetMode(this InheritVelocityModule module, Func modeChanger)
+ public static InheritVelocityModule SetMode(this InheritVelocityModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func modeChanger)
{
Debug.Assert(modeChanger != null, "modeChanger cannot be null");
module.mode = modeChanger(module.mode);
diff --git a/Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/InheritVelocityModuleExtension.cs.meta b/Packages/FluentParticleSystem/Runtime/Extensions/InheritVelocityModuleExtension.cs.meta
similarity index 100%
rename from Packages/FluentParticleSystem/Runtime/NonNullable/Extensions/InheritVelocityModuleExtension.cs.meta
rename to Packages/FluentParticleSystem/Runtime/Extensions/InheritVelocityModuleExtension.cs.meta
diff --git a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/LifetimeByEmitterSpeedModuleExtension.cs b/Packages/FluentParticleSystem/Runtime/Extensions/LifetimeByEmitterSpeedModuleExtension.cs
similarity index 74%
rename from Packages/FluentParticleSystem/Runtime/Nullable/Extensions/LifetimeByEmitterSpeedModuleExtension.cs
rename to Packages/FluentParticleSystem/Runtime/Extensions/LifetimeByEmitterSpeedModuleExtension.cs
index abfe4dc..c758a80 100644
--- a/Packages/FluentParticleSystem/Runtime/Nullable/Extensions/LifetimeByEmitterSpeedModuleExtension.cs
+++ b/Packages/FluentParticleSystem/Runtime/Extensions/LifetimeByEmitterSpeedModuleExtension.cs
@@ -1,9 +1,13 @@
-#nullable enable
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
+
using static UnityEngine.ParticleSystem;
+#if UNITY_2020_2_OR_NEWER
+using System.Diagnostics.CodeAnalysis;
+#endif
+
namespace OUCC.FluentParticleSystem
{
public static class LifetimeByEmitterSpeedModuleExtension
@@ -13,7 +17,18 @@ public static class LifetimeByEmitterSpeedModuleExtension
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem EditLifetimeByEmitterSpeed(this ParticleSystem particleSystem, Action moduleEditor)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem EditLifetimeByEmitterSpeed(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Action moduleEditor)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(moduleEditor != null, "moduleEditor cannot be null");
@@ -26,7 +41,14 @@ public static ParticleSystem EditLifetimeByEmitterSpeed(this ParticleSystem part
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedCurve(this ParticleSystem particleSystem, MinMaxCurve curve)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, MinMaxCurve curve)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.lifetimeByEmitterSpeed;
@@ -38,7 +60,18 @@ public static ParticleSystem SetLifetimeByEmitterSpeedCurve(this ParticleSystem
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedCurve(this ParticleSystem particleSystem, Func curveChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedCurve(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(curveChanger != null, "curveChanger cannot be null");
@@ -61,7 +94,11 @@ public static LifetimeByEmitterSpeedModule SetCurve(this LifetimeByEmitterSpeedM
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static LifetimeByEmitterSpeedModule SetCurve(this LifetimeByEmitterSpeedModule module, Func curveChanger)
+ public static LifetimeByEmitterSpeedModule SetCurve(this LifetimeByEmitterSpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveChanger)
{
Debug.Assert(curveChanger != null, "curveChanger cannot be null");
module.curve = curveChanger(module.curve);
@@ -74,7 +111,14 @@ public static LifetimeByEmitterSpeedModule SetCurve(this LifetimeByEmitterSpeedM
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedCurveMultiplier(this ParticleSystem particleSystem, float curveMultiplier)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedCurveMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, float curveMultiplier)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.lifetimeByEmitterSpeed;
@@ -86,7 +130,18 @@ public static ParticleSystem SetLifetimeByEmitterSpeedCurveMultiplier(this Parti
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedCurveMultiplier(this ParticleSystem particleSystem, Func curveMultiplierChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedCurveMultiplier(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveMultiplierChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(curveMultiplierChanger != null, "curveMultiplierChanger cannot be null");
@@ -109,7 +164,11 @@ public static LifetimeByEmitterSpeedModule SetCurveMultiplier(this LifetimeByEmi
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static LifetimeByEmitterSpeedModule SetCurveMultiplier(this LifetimeByEmitterSpeedModule module, Func curveMultiplierChanger)
+ public static LifetimeByEmitterSpeedModule SetCurveMultiplier(this LifetimeByEmitterSpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func curveMultiplierChanger)
{
Debug.Assert(curveMultiplierChanger != null, "curveMultiplierChanger cannot be null");
module.curveMultiplier = curveMultiplierChanger(module.curveMultiplier);
@@ -122,7 +181,14 @@ public static LifetimeByEmitterSpeedModule SetCurveMultiplier(this LifetimeByEmi
/// Assign a value to
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedEnabled(this ParticleSystem particleSystem, bool enabled)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem, bool enabled)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
var module = particleSystem.lifetimeByEmitterSpeed;
@@ -134,7 +200,18 @@ public static ParticleSystem SetLifetimeByEmitterSpeedEnabled(this ParticleSyste
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ParticleSystem SetLifetimeByEmitterSpeedEnabled(this ParticleSystem particleSystem, Func enabledChanger)
+#if UNITY_2020_2_OR_NEWER
+ [return: NotNull]
+#endif
+ public static ParticleSystem SetLifetimeByEmitterSpeedEnabled(
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ this ParticleSystem particleSystem,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(particleSystem != null, "particleSystem cannot be null");
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
@@ -157,7 +234,11 @@ public static LifetimeByEmitterSpeedModule SetEnabled(this LifetimeByEmitterSpee
/// Edit
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static LifetimeByEmitterSpeedModule SetEnabled(this LifetimeByEmitterSpeedModule module, Func enabledChanger)
+ public static LifetimeByEmitterSpeedModule SetEnabled(this LifetimeByEmitterSpeedModule module,
+#if UNITY_2020_2_OR_NEWER
+ [DisallowNull]
+#endif
+ Func enabledChanger)
{
Debug.Assert(enabledChanger != null, "enabledChanger cannot be null");
module.enabled = enabledChanger(module.enabled);
@@ -170,7 +251,14 @@ public static LifetimeByEmitterSpeedModule SetEnabled(this LifetimeByEmitterSpee
/// Assign a value to