Skip to content

Instantly share code, notes, and snippets.

@Volorf
Created August 14, 2024 16:04
Show Gist options
  • Save Volorf/0d3cff2707d94e3d05b0f83d44bc69e2 to your computer and use it in GitHub Desktop.
Save Volorf/0d3cff2707d94e3d05b0f83d44bc69e2 to your computer and use it in GitHub Desktop.
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