i get an error that has to deal with FindObjectsofType<>
Assets/Script/HurtPlayer.cs(9,17): error CS0029: Cannot implicitly convert type LevelManager[]' to LevelManager’
it is the same for my PlayerController. What do I do
i get an error that has to deal with FindObjectsofType<>
Assets/Script/HurtPlayer.cs(9,17): error CS0029: Cannot implicitly convert type LevelManager[]' to LevelManager’
it is the same for my PlayerController. What do I do
There are two similar methods. One returns a single object and the other returns an array of objects.
FindObjectOfType
FindObjectsOfType
Note the ‘s’ in the word Objects.
LevelManager lm = FindObjectOfType<LevelManager>();
if you wanted to find multiple of objects of the same type:
LevelManager[] lm = FindObjectsOfType<LevelManager>();