John Doe

Tom Wor

Capitalisms sad panda. Captain of the nuclear submarine KillerChestWorkout, accompanied by his cook Ed and sea lion lady Dolores.

Mastodon Twitter

Using Unitys Asyncoperation Completed With Anonymous Callback Function

Nov 11, 2018 - 1 min read

Say you want to load a scene asynchronously and need to trigger an event right after the scene has loaded, a quick two-liner does the job.

AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(this.DefaultLevel, LoadSceneMode.Additive);
asyncLoad.completed += operation => MessageDispatcher.SendMessage("MENU_START");

Pushing Cinemachine Camera to Do a Hard Position Change With Ontargetobjectwarped

Oct 15, 2018 - 1 min read

While switching my camera system on Super Space Arcade from a classic camera rig to Cinemachine, I stumbled over an issue where the virtual camera would change its position smoothly, even though I set the transform to a new value. In my case, I need a hard reset of the camera position for the linear track being reset, to not run into overflow errors.

The way this can be achieved with Cinemachine I dug up somewhere in the forums, is

CinemachineComponentBase.OnTargetObjectWarped(Transform, Vector3)

The first parameter is the moving objects transform, the second is the transform offset. In my case, the code looks something like this

CinemachineVirtualCamera vcam = this.GetComponent<CinemachineVirtualCamera>();
vcam.OnTargetObjectWarped(playerTransform, new Vector3(0,0,-trackResetZ);

Xbox 360 Controller Driver for Macosx Including Mojave

Oct 11, 2018 - 1 min read

After setting up Mojave on my MacBook I realized I’ve had to install the XBox 360 Controller driver again. Somehow that was really hard to find among many outdated sources, so I’m putting this here for anyone searching for it and myself for future reference.

The driver is available at Github here.