Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity change color of sprite in script

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

public class setColor : MonoBehaviour
{
     SpriteRenderer sprite;
     
     //this will easilly make u choose the color u want
     public Color newColor;
     
    void Start()
    {
        sprite = GetComponentInChildren<SpriteRenderer>();
        sprite.color = newColor; 
    }
}
 
PREVIOUS NEXT
Tagged: #unity #change #color #sprite #script
ADD COMMENT
Topic
Name
8+5 =