Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public class PlayerTargeting : MonoBehaviour {
- public List<Transform> targets;
- // Use this for initialization
- void Start () {
- targets = new List<Transform>();
- AddAllEnemys();
- }
- public void AddAllEnemys()
- {
- GameObject[] go = GameObject.FindGameObjectWithTag("Enemy");
- foreach(GameObject enemy in go)
- AddTarget(enemy.transform);
- }
- public void AddTarget(Transform enemy)
- {
- targets.Add(enemy);
- }
- // Update is called once per frame
- void Update () {
- }
- }
- Assets/Scripts/PlayerScripts/PlayerTargeting.cs(20,30): error CS0029: Cannot implicitly convert type `UnityEngine.GameObject' to `UnityEngine.GameObject[]'
Advertisement
Add Comment
Please, Sign In to add comment