Initial commit
This commit is contained in:
30
Assets/scripts/randInitColor.cs
Normal file
30
Assets/scripts/randInitColor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user