Integrating with Ultimate FPS

Note that UFPS-ready Player prefabs are available on the downloads page.

In this tutorial, we'll make a Player prefab that's compatible with both Adventure Creator and the Ultimate FPS asset, which is a separate Unity asset for first-person games.

NOTE: Be sure to use the latest versions of both assets - this tutorial makes use of Adventure Creator v1.50 and Ultimate FPS v1.4.9.

Since Adventure Creator and Ultimate FPS are both categorised as Complete Projects, they will both overwrite your Input and Layer settings. But since UFPS makes more changes, it is easier to install UFPS after Adventure Creator. AC's required Inputs and Layers can be added back in manually, following section 1.1 of the Manual.

Once you have both Adventure Creator and UFPS installed in your Unity project, go to the Settings Manager, and set the Movement method setting to First Person.

We now need to add the 'UltimateFPSIsPresent' preprocessor to your Player Settings. This is necessary so that Adventure Creator knows it's "safe" to expect certain UFPS scripts in your project.

From the top toolbar, choose Edit -> Project Settings -> Player, and open up the Other settings section. In the Scripting Define Symbols box, enter in 'UltimateFPSIsPresent'.

The alert message in the Settings Manager will now disappear, and we can now create our Player prefab.

It's easiest to modify a ready-made UFPS player prefab. In this tutorial, we'll modify the Camera&Controller prefab, which is found in UFPS -> Base -> Content -> Prefabs -> Players. Drag this prefab into a new scene, and rename it, as we'll be creating a new prefab.

Make sure that the prefab has been given the Player tag. Next, add the UltimateFPSIntegration script component to the base GameObject - AC's Player and Paths component will also been added automatically. If your player doesn't require a model, you can leave all settings in the Player inspector as their default values.

The prefab is now ready. As with other Adventure Creator player prefabs, you place this prefab in an Asset folder, remove it from the scene, and assign it as the Player in your Settings Manager.

However, you can also have the Player present in the scene - which may be necessary if you need to work with e.g. weapons for your game.

When in First Person mode, Adventure Creator has two mouse modes: locked and unlocked. When locked, the game plays in regular first-person mode, with the mouse cursor being used to "free-aim". When unlocked, the first-person camera is locked, and the mouse can be used to click on Hotspots and Menus. The cursor will be automatically be unlocked during pause menus.

You can allow the player to toggle between the two modes by defining an Input button called ToggleCursor within the Input manager (Edit -> Project settings -> Input), and you can decide which mode your game begins in from the Lock cursor in screen's centre when game begins? setting.

You can also use the Player: Constrain Action mid-game to disable free-aiming - effectively unlocking the cursor. The Settings Manager also has an option to only allow the player to interact with Hotspots when the cursor is unlocked - this is useful for e.g. weapon-based games, where you don't want combat to interfere with interactions.

When building a scene for use with your new UFPS player, be sure to follow UFPS's requirements so far as objects layers go. While Adventure Creator scene geometry should normally be placed on the Ignore Raycast layer, this will prevent UFPS from working correctly. Instead, objects should generally be placed on the Default layer.

You may wish to avoid using Hotspots and other Adventure Creator-based logic, and rely instead on UFPS' Interaction functionality. You can easily trigger Adventure Creator Cutscene objects by calling the "Interact" message on them. Adventure Creator will remove control from the player during Cutscenes, so if you wish to make certain events play in the background, be sure to set the Cutscene's When running setting to Run In Background.

Be aware:
As UFPS is a complex asset that can be used to make a variety of first-person games, Adventure Creator's integration is intended more for non-combat games, but can be easily extended to suit your needs. The UtimateFPSIntegration script is isolated from the rest of AC, meaning you can duplicate and modify it if you need to extend it.

Adventure Creator and this website are copyright Chris Burton, ICEBOX Studios

Go to top