# RemoveInfluence

> Removes the Force Field from the influencers list at the given index.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.ParticleSystemModule

## RemoveInfluence(int)

Removes the Force Field from the influencers list at the given index.

```csharp
public void RemoveInfluence(int index)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index to remove the chosen Force Field from.

### Remarks

When [ParticleSystem.ExternalForcesModule.influenceFilter](/engine/6000.0/script-reference/unityengine/particlesystem/externalforcesmodule/influencefilter.md) is set to [ParticleSystemGameObjectFilter.List](/engine/6000.0/script-reference/unityengine/particlesystemgameobjectfilter/list.md) then only Force Fields in the influencers list affect the Particle System.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    ParticleSystem.ExternalForcesModule externalForcesModule;

    void Start()
    {
        // Create a default particle system
        var particleSystemGameObject = new GameObject("Particle System");
        var system = particleSystemGameObject.AddComponent<ParticleSystem>();

        // Create a force field to influence the particle system
        var forceFieldGameObject = new GameObject("Force Field");
        var forceField = forceFieldGameObject.AddComponent<ParticleSystemForceField>();
        forceField.endRange = 5;
        forceFieldGameObject.transform.position = new Vector3(0, 0, 10);

        // Add the force to the particle systems external forces influencers.
        externalForcesModule = system.externalForces;
        externalForcesModule.enabled = true;
        externalForcesModule.influenceFilter = ParticleSystemGameObjectFilter.List;
        externalForcesModule.AddInfluence(forceField);
    }

    void OnGUI()
    {
        GUILayout.Label("Particle System Influencers:");
        for (int i = 0; i < externalForcesModule.influenceCount; ++i)
        {
            var influence = externalForcesModule.GetInfluence(i);

            GUILayout.BeginHorizontal();
            GUILayout.Label(i + ": " + influence.name);
            if (GUILayout.Button("Remove"))
            {
                externalForcesModule.RemoveInfluence(i);
                --i;
            }
            GUILayout.EndHorizontal();
        }
    }
}
```

## RemoveInfluence(ParticleSystemForceField)

Removes the Force Field from the influencers list at the given index.

```csharp
public void RemoveInfluence(ParticleSystemForceField field)
```

### Parameters

**** (\[ParticleSystemForceField]\(/engine/6000.0/script-reference/unityengine/particlesystemforcefield)): The Force Field to remove from the list.

### Remarks

When [ParticleSystem.ExternalForcesModule.influenceFilter](/engine/6000.0/script-reference/unityengine/particlesystem/externalforcesmodule/influencefilter.md) is set to [ParticleSystemGameObjectFilter.List](/engine/6000.0/script-reference/unityengine/particlesystemgameobjectfilter/list.md) then only Force Fields in the influencers list affect the Particle System.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    ParticleSystem.ExternalForcesModule externalForcesModule;

    void Start()
    {
        // Create a default particle system
        var particleSystemGameObject = new GameObject("Particle System");
        var system = particleSystemGameObject.AddComponent<ParticleSystem>();

        // Create a force field to influence the particle system
        var forceFieldGameObject = new GameObject("Force Field");
        var forceField = forceFieldGameObject.AddComponent<ParticleSystemForceField>();
        forceField.endRange = 5;
        forceFieldGameObject.transform.position = new Vector3(0, 0, 10);

        // Add the force to the particle systems external forces influencers.
        externalForcesModule = system.externalForces;
        externalForcesModule.enabled = true;
        externalForcesModule.influenceFilter = ParticleSystemGameObjectFilter.List;
        externalForcesModule.AddInfluence(forceField);
    }

    void OnGUI()
    {
        GUILayout.Label("Particle System Influencers:");
        for (int i = 0; i < externalForcesModule.influenceCount; ++i)
        {
            var influence = externalForcesModule.GetInfluence(i);

            GUILayout.BeginHorizontal();
            GUILayout.Label(i + ": " + influence.name);
            if (GUILayout.Button("Remove"))
            {
                externalForcesModule.RemoveInfluence(i);
                --i;
            }
            GUILayout.EndHorizontal();
        }
    }
}
```
