Why is .getComponent here 'not a function' in console errors?

        for (let i = 0; i < this.hotspots.length; i++) 
        {
            if(i != currHotspot)
            {
               this.hotspots[i].getComponent(Hotspot).animCtrl.SetTrigger("Close");
            }
        }

Original Post on Discord

by user 103054507105067008

A hotspot entry is a component?

Rewrote as

               let animT = this.hotspots[i].getComponent(Hotspot);
               animT.animCtrl.SetTrigger("Close");

Still not playing ball :frowning_with_open_mouth:

by user 103054507105067008

Hotspot is a script import { Hotspot } from "./Hotspot";

by user 103054507105067008

Yep

by user 103054507105067008

Then [i].gameObject.getComponent

ah actually my array got cleared out, the other issue about an array of components before this is the main issue

by user 103054507105067008