FBInstant games SDK gives the error "Cannot find name 'FBInstant'.ts(2304)" in Cocos Creator 3.8.
I have been trying to follow this guide to make the module be detected: https://docs.cocos.com/creator/manual/en/editor/publish/publish-fb-instant-games.html?h=landscape
It says:
"Currently Cocos Creator does the work for users including:
Integration with Facebook Instant Games SDK and automatic initialization, allowing users to call the relevant APIs directly One-click packaging process in the Cocos Creator build panel to package games directly to Facebook Instant Games specifications What the user needs to do:
Call the Facebook Instant Games SDK to access platform-related features Upload the packaged version of Cocos Creator to Facebook"
It also says:
"The Creator is integrated with the Instant Games SDK provided by Facebook and is automatically initialized when the game is loaded (initializeAsync and startGameAsync). Users can access it directly through the FBInstant module, see Instant Games SDK for instructions. In addition, Facebook also provides a Facebook SDK for JavaScript to access Facebook's social features, which can be accessed through the FB module. However, this SDK Creator is not integrated and needs to be introduced manually by the user, see official documentation."
However, if I try to use the FBInstant module in my script then I get the error: "Cannot find name 'FBInstant'.ts(2304)",
Does anyone have any examples or tutorials of how to use the Facebook Instant Games SDK with Cocos Creator. Or does anyone know how to import the module in a way where I dont get this error? I dont want the error to just go away, I want the module to actually be loaded correctly.
I have searched through the Githubs of the tutorials on the Cocos page for tutorials and examples: https://docs.cocos.com/creator/manual/en/cases-and-tutorials/
But I cant seem to find any Facebook Instant Games examples.
Can you help or give me an idea about how to proceed? Thank you. Examples would be great if you have any too!
Please declare FBInstant using the var keyword to get it to work. As the FBInstant SDK will be initialized in runtime, you must declare it to use. please add this line
it should fix your issue.