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

1 messages · Page 1 of 1 (latest)

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

A hotspot entry is a component?

hearty geyser
#

Rewrote as

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

Still not playing ball 😦

#

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

#

Yep

sour seal
#

Then [i].gameObject.getComponent