How to access components on a GameObject?

Hi, I’m currently trying to access a specific component on an newly spawned gameObject (IGameObject). getComponent is not availible, neither is a gameObject object. I’m sure there is an easy way, but I can’t figure out how to do it :sweat_smile:
image.png

Original Post on Discord

by user 474974683163394049

Why is it not available? Maybe just vscode? You can also use the static method on GameObject

VSCode tells me: “Property ‘getComponent’ does not exist on type ‘IGameObject’.”

by user 474974683163394049

Ahhh, my bad. It’s too obvious :sweat_smile:
this.renderer = GameObject.getComponent(cubeElement, Renderer);

by user 474974683163394049

It’s again me brain vs. not using Unity C# while working with Unity :rofl:

by user 474974683163394049

VSCode was kind of right: the interface was missing the methods (even tho they did exist on the object) - added them now so it’ll not error in the next version anymore