Hi i get this error when trying to change color of spriterenderer
Assets\Scripts\Changecolour.cs(37,20): error CS0103: The name ‘newColor’ does not exist in the current context
This is my Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Changecolour : MonoBehaviour
{
public SpriteRenderer SpriteR;
private void Awake()
{
}
// Update is called once per frame
private void FixedUpdate()
{
if (SpriteR != null)
{
Debug.Log(SpriteR);
Color newColor = new Color(
Random.value,
Random.value,
Random.value
);
}
SpriteR = newColor;
}
}