# SetSHCoefficientsSelf(SphericalHarmonicsL2[])

> Sets the spherical harmonics coefficients of the baked light probes stored in this LightProbes object.

## Definition

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

```csharp
public bool SetSHCoefficientsSelf(SphericalHarmonicsL2[] coefficients)
```

### Parameters

**** (\[SphericalHarmonicsL2\[]]\(/engine/6000.7/script-reference/unityengine/rendering/sphericalharmonicsl2)): The spherical harmonics coefficients to set.

### Returns

| Type                                                          | Description                                                            |
| ------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` when the coefficients were successfully set. Otherwise `false`. |

### Remarks

When you change the spherical harmonics coefficients using this method, you must call [LightProbes.Tetrahedralize](/engine/6000.7/script-reference/unityengine/lightprobes/tetrahedralize.md) or [LightProbes.TetrahedralizeAsync](/engine/6000.7/script-reference/unityengine/lightprobes/tetrahedralizeasync.md) to fully apply the changes.

Additional Resources: [LightProbes.GetSHCoefficientsSelf](/engine/6000.7/script-reference/unityengine/lightprobes/getshcoefficientsself.md), [LightProbes.countSelf](/engine/6000.7/script-reference/unityengine/lightprobes/countself.md), [SphericalHarmonicsL2](/engine/6000.7/script-reference/unityengine/rendering/sphericalharmonicsl2.md).

### Examples

```csharp
// Attach this script to a GameObject in a scene that contains baked light probes,
// then enter Play mode. The script gets the LightProbes object for the scene,
// and tints only the probes belonging to the scene with a specified color.

using UnityEngine;
using UnityEngine.Rendering;

public class SetSHCoefficientsSelfExample : MonoBehaviour
{
    public Color tint = new Color(1.0f, 0.6f, 0.6f);

    void Start()
    {
        LightProbes probes = LightProbes.GetInstantiatedLightProbesForScene(gameObject.scene);
        if (probes == null || probes.countSelf == 0)
        {
            Debug.Log("The scene contains no baked light probes.");
            return;
        }

        SphericalHarmonicsL2[] coefficients = probes.GetSHCoefficientsSelf();
        for (int i = 0; i < coefficients.Length; i++)
        {
            for (int coefficient = 0; coefficient < 9; coefficient++)
            {
                coefficients[i][0, coefficient] *= tint.r;
                coefficients[i][1, coefficient] *= tint.g;
                coefficients[i][2, coefficient] *= tint.b;
            }
        }

        probes.SetSHCoefficientsSelf(coefficients);
        LightProbes.Tetrahedralize();
    }
}
```
