Created
August 14, 2024 16:04
-
-
Save Volorf/0d3cff2707d94e3d05b0f83d44bc69e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Planet : MonoBehaviour | |
{ | |
[SerializeField] List<Color> colors; | |
[SerializeField] MeshRenderer meshRenderer; | |
[SerializeField] Vector2 scaleRange; | |
void Start() | |
{ | |
meshRenderer.material.color = GetRandomColor(); | |
transform.localScale = Vector3.one * Random.Range(scaleRange.x, scaleRange.y); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
} | |
Color GetRandomColor() | |
{ | |
return colors[Random.Range(0, colors.Count)]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment