- Home /
Cannot implicitly convert type
I'm making my first game, and when I hover over the red line, it says "cannot implicitly convert type UnityEngine.GameObject[] to UnityEngine.GameObject"
Any Ideas on how to fix this?
cannot.png
(17.1 kB)
Comment
Answer by ghostmode · Oct 18, 2017 at 03:50 AM
GameObject.FindGameObjectsWithTag
returns an array of game objects, as there might be many objects with the same tag.
Try using GameObject.FindWithTag
instead, that returns the first game object with that tag.
There's an example in the docs here.
Your answer
![](https://koobas.hobune.stream/wayback/20220612141311im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My game wont start after i click a button 1 Answer
Infinity Hallway 1 Answer
Slow down everything besides Player? 1 Answer
Player Screen Resolution 2 Answers
How to run a script to only 1 player in a multiplayer fps 1 Answer