31 lines
819 B
C#
31 lines
819 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class randInitColor : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
public float minR = 0;
|
|
public float minG = 0;
|
|
public float minB = 0;
|
|
|
|
public float maxR = 1;
|
|
public float maxG = 1;
|
|
public float maxB = 1;
|
|
void Start()
|
|
{
|
|
float r = Random.RandomRange(minR, maxR);
|
|
float g = Random.RandomRange(minG, maxG);
|
|
float b = Random.RandomRange(minB, maxB);
|
|
gameObject.GetComponent<SpriteRenderer>().color = new Color(r, g, b, 1);
|
|
gameObject.GetComponent<SpriteRenderer>().enabled = false;
|
|
gameObject.GetComponent<SpriteRenderer>().enabled = true;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|