Missing }, but not really

It gives me CS1513 thinks there needs to be a closing curly, but I checked it’s fine. What’s wrong?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScatterBallExplose : MonoBehaviour
{
    public ParticleSystem ms;
    private ParticleSystem ps;
    private CameraShake cs;
    public int life;
    public static int maxLife = 3;

    // Start is called before the first frame update
    void Start()
    {
        cs = Camera.main.GetComponent<CameraShake>();
        life = maxLife;
    }

    // Update is called once per frame
    void Update()
    {
       
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        print("Collision detected");
        float dx = col.transform.position.x - this.transform.position.x;
        float dy = col.transform.position.y - this.transform.position.y;
        //double hyp = Mathf.Sqrt(Mathf.Pow(dx, 2) + Mathf.Pow(dy, 2));
        float atan = Mathf.Atan(dx / dy) * Mathf.Rad2Deg;
        print(atan);
        ps = Instantiate(ms);
        ps.transform.rotation = Quaternion.Euler(90+atan,0,0);
        ps.transform.position = this.transform.position;
        ps.Play();
        StartCoroutine(cs.Shake(.15f, transform.localScale.x, transform.localScale.y));
        life--;
        //UpdateScatterBallLifeColor(life);
    }

    void UpdateScatterBallLifeColor(int life)
    {
        private Color newColor = new Color(this.Color.red, this.Color.green, this.Color.blue, life/maxLife);
        this.renderer.material.color = newColor;
    }
}

Specifically, on line 44.

Next time post the exact error message as well as the line number. We don’t play “guess where the error is”.

Anyways, in line 45 you have a “private” inside your method which makes no sense. access modifiers can only be applied to members of a type.

Though you have additional issues in that line. Your class does not have a field / member called Color. So this.Color makes no sense.

Likewise the “renderer” property has been deprecated years ago. So this.renderer won’t work either. You probably want to use GetComponent<Renderer>() instead.

Is it the private ?? I don’t think you can specify private here

You guys were right. It can’t be private. Thanks.

I said line 44, read the whole post before commenting. We don’t play “guess what OP wrote”.

I did, you posted your second post after I wrote my answer. You did not include the line in your question where it belongs.

Sometimes debug fires before the problem. If you’re really unlucky the debug fires the line at the end of a bracket will leave you clueless and force you to place debugs all over to find out how far your code makes it before the problem.

Luckily this time it was simple and one line below