new-horizons/NewHorizons/Utility/AddDebugShape.cs
2022-05-22 18:48:23 -07:00

20 lines
703 B
C#

using UnityEngine;
namespace NewHorizons.Utility
{
public static class AddDebugShape
{
public static GameObject AddSphere(GameObject obj, float radius, Color color)
{
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.GetComponent<SphereCollider>().enabled = false;
sphere.transform.parent = obj.transform;
sphere.transform.localScale = new Vector3(radius, radius, radius);
sphere.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Sprites/Default"));
sphere.GetComponent<MeshRenderer>().material.color = color;
return sphere.gameObject;
}
}
}