using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.VFX; [ExecuteInEditMode] public class GizmoManager : MonoBehaviour { public GameObject m_VFX; private LineRenderer lineRenderer; void Start(){ lineRenderer = this.GetComponent(); lineRenderer.startWidth = 0.2f; lineRenderer.endWidth = 0.2f; //lineRenderer.material = new Material(Shader.Find("Sprites/Default")); //lineRenderer.material.color = Color.yellow; } void Update(){ DrawWireframe(m_VFX); } void DrawWireframe(GameObject m_Smoke){ Bounds m_SmokeBounds = m_Smoke.GetComponent().bounds; Vector3[] vertices = new Vector3[16]; // Calculate the vertices of the box vertices[0] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.min.y, m_SmokeBounds.min.z); vertices[1] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.min.y, m_SmokeBounds.min.z); vertices[2] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.min.y, m_SmokeBounds.max.z); vertices[3] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.min.y, m_SmokeBounds.max.z); vertices[4] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.min.y, m_SmokeBounds.min.z); vertices[5] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.max.y, m_SmokeBounds.min.z); vertices[6] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.max.y, m_SmokeBounds.min.z); vertices[7] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.min.y, m_SmokeBounds.min.z); vertices[8] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.max.y, m_SmokeBounds.min.z); vertices[9] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.max.y, m_SmokeBounds.max.z); vertices[10] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.min.y, m_SmokeBounds.max.z); vertices[11] = new Vector3(m_SmokeBounds.max.x, m_SmokeBounds.max.y, m_SmokeBounds.max.z); vertices[12] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.max.y, m_SmokeBounds.max.z); vertices[13] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.min.y, m_SmokeBounds.max.z); vertices[14] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.max.y, m_SmokeBounds.max.z); vertices[15] = new Vector3(m_SmokeBounds.min.x, m_SmokeBounds.max.y, m_SmokeBounds.min.z); lineRenderer.positionCount = vertices.Length; lineRenderer.SetPositions(vertices); } }