Support Forums

Netlify function to trigger something in unity game engine

Hello newbie here :slight_smile:

I have been trying to set up the following functionality:

  • Use netlify to host a static site
  • Users go to the website and interact with it (simple example they press a button)
  • Unity does something cool - shows an animation etc.

Currently I’m using Fauna to store “button presses” from the site and then polling the database from Unity which works but I’d like to try doing it without polling.

Is there a way I can utilize netlify functions to do something of this nature? Or can someone point me in the direction of some resources because I’m not even sure what to google haha.

I’m not sure if this is the right place to ask so feel free to move/close this if that’s the case!

Many thanks!

You’re probably looking for this: Unity - Manual: WebGL: Interacting with browser scripting

This way, you can setup a function in Unity to be called when you run something in JavaScript. This would be completely client-side, no Netlify Functions or FaunaDB needed. No need to poll anywhere too.

Hey thanks for the reply! Sorry for the long delay in my response lol. Those do look interesting I will check them out! I kinda wanted to call an API from a public website like on a random persons phone and then unity running on another computer picks it up. This is for an interactive installation :smiley: