using System.Collections; using System.Collections.Generic; using UnityEngine; public class BuildWithEffect : MonoBehaviour { public MainWeapon player; public ToweHealthController tower; public GameObject prefVFX; void Start() { player = FindObjectOfType(); //Instantiate(prefVFX); } private void OnEnable() { player = FindObjectOfType(); if(player != null && player.GetComponent().ownerIndex == tower.owner) Instantiate(prefVFX, player.GetComponentInParent()); } private void Update() { } }