To request access to the OneJS private repo, please message Singtaa on Discord with your Invoice # and Github username. Our Discord is also a great place to chat and search for answers already asked by the community.

useUnityUpdate Hook


useUnityUpdate() is a hook that allows you to perform simple operations in the Unity's LateUpdate() life cycle.

When not to use it

  • Performing critical operations
  • Reading input during gameplay or intense scenes
  • Performing heavy operations

So... When can I use it?

If performance isn't a problem, you can use to read simple inputs to perform actions (i.e: "Press enter to continue" scene). Should be noticed, that if you're using the new input system, subscribing to callbacks will be more performant than this method.

Steps to implement the hook

1- Create a file called unity-hooks.tsx

2- Copy the following code:

const update = signal({});

export const useUnityUpdate = (callback: () => void) => {
    return update.subscribe(() => callback());

function Update(time) {
    update.value = {};

How to use it:

export const SplashScreen = () => {

    // Callback once per LateUpdate()
    const unsubscribe = useUnityUpdate(() => {
        if(Input.GetKeyDown(KeyCode.A) {
              // Do something

    // always, always, always (ALWAYS!!!) unsubscribe, else you'll have memory leak / bleed
    useEffect(() => {
        return () => {
    }, []);