using System.Collections; using System.Collections.Generic; using UnityEngine; public class test2Collider : MonoBehaviour { public Color _defaultRender; public Color color = Color.green; List green; void Start() { GameObject parent = gameObject; green = FindGameObjectInChildWithTag(parent, "green"); } void OnMouseEnter() { Debug.Log($"навели мышь"); color.a = 0.5f; OnColor(); } void OnMouseExit() { if (!hlight.l) { color.a = 0f; OnColor(); } } void OnColor() { foreach (GameObject gr in green) { gr.GetComponent().material.color = color; } } public static List FindGameObjectInChildWithTag(GameObject parent, string tag) { Transform[] TempArray; TempArray = parent.GetComponentsInChildren(); var green = new List(); foreach (Transform gr in TempArray) { if (gr.gameObject.tag == tag) green.Add(gr.gameObject); } Debug.Log($"green {green}"); return green; //return null; } }