Jump to content
  • Sign Up

    Welcome to CANOPY.

    Browse the Forums, read articles in the Library, share your work in the Gallery, get the latest in Downloads

    Want more? Subscribe and get all our assets for a fraction of their asset store purchase price!

  • Runtime Module: Controller Support


    Peter

    Applies to: Gaia (Pro) 2023

    Gaia (Pro) 2023 comes with a variety of optional Runtime Modules that you can use to enhance your scene. This article details the Controller Support module which allows you to add ready-made player controllers to your world, or add support for your own custom controller.

    Prerequisistes

    Using the Fly cam or First & 3rd Person Controller requires the unity input system package to be installed. The First and 3rd Person Controllers are integrations for Unity's Starter Assets that you can download for free from the Asset Store:
    Starter Assets - First Person Character Controller
    Starter Assets - Third Person Character Controller
    These packages will install the input system package automatically as a dependency. The asset store description notes that these packages are only compatible with the Universal Rendering pipeline, however they work perfectly fine in Built-In and HDRP as well with very little effort, please see the section on Render Pipeline Support at the end of the article.

    Usage

    In a nutshell, you can select the Controller type you want in the Controller Support Module and click "Apply" to add that controller to the scene, or "Remove" to remove it again. Since Gaia knows about the other systems used in the scene, it will also automatically configure associated systems for this controller. For example, if you are using Gaia Terrain Loading, a terrain loader script will be added to the camera. Or if using Gaia Water, the camera is referenced in that script so that underwater effects work correctly when the camera goes under water.

    What controller is being added to the scene and the available options for it, change according to the controller type that is selected:

    image.png


    The following sections explain the different controller types and the options for them.

    Fly Cam

    The Fly Cam is a flying camera without collisions that can be controlled with classic FPS controls. This controller type is good for flying around your scene to take a look at the terrain from different angles quickly. It comes with the following options:

    Add Location System - Adds a script to the camera that allows you to bookmark locations and revisit them. This can be comfortable when iterating on the scene and you want to be able to quickly jump to your favorite locations again and again.

    Add Audio Manager - Adds a script to the camera designed to work with the spawnable Gaia Audio Zones (Gaia Pro feature).

    During runtime, you can control the Fly Cam with the controls showing in the lower left corner of the screen. Depending on whether you added the Location System and / or the Screenshotter (found in the Utilities Runtime Module) there will be instructions for those as well.
     

    First Person - Unity Starter Assets

    This is a classic FPS-style first-person controller which is perfect for experiencing your scene as a humanoid walking on the terrain. This controller is an integration for the Unity Starter Asset: First Person Controller, which needs to be installed before you can use it. It comes with the following options:

    Activate Touch UI - Adds the mobile UI from the First Person Controller - this allows you to control the character on touch devices such as Smart Phones or Tablets.

    Add Audio Manager - Adds a script to the camera designed to work with the spawnable Gaia Audio Zones (Gaia Pro feature).

    During runtime, you can control the First Person Controller with classic FPS controls. (WASD on keyboard, mouse to look, etc.) For specific features of the Controller itself, please refer to the original Unity documentation found in the "Starter Assets" folder.
     

    Third Person - Unity Starter Assets

    This is a classic third-person controller which is perfect for experiencing your scene from a third-person perspective where you can see the controlled character in the scene. This controller is an integration for the Unity Starter Asset: Third Person Controller, which needs to be installed before you can use it. It comes with the following options:

    Activate Touch UI - Adds the mobile UI from the Third Person Controller - this allows you to control the character on touch devices such as Smart Phones or Tablets.

    Add Audio Manager - Adds a script to the camera designed to work with the spawnable Gaia Audio Zones (Gaia Pro feature).

    During runtime, you can control the robot character with classic third person controls on mouse and keyboard or your gamepad. (WASD on keyboard, mouse to look, etc.) For specific features of the Controller itself, please refer to the original Unity documentation found in the "Starter Assets" folder.


    Custom - Configure your own Controller

    This option does not add a new controller to the scene, but rather allows you to configure your own, already existing controller in the scene. Imagine you made your own custom 3rd person controller, or you are using one bought from the asset store. Gaia's systems would need to know what the character and the camera for this controller is - only then things like underwater effects can function correctly. In order to set up all associated systems in Gaia, you can drag and drop your character game object and the camera into these two slots and click Apply:

    image.png

    This will then e.g. set up the camera in Gaia's underwater VFX script so that the underwater effects are being activated when this camera goes underwater. If your character and your camera are the same game object, it is ok to assign it into both slots. If you do not have a camera in the scene that you could assign here, you would not need to perform this controller setup step as well.


    Runtime Generated

    This option also does not add a new controller to the scene, but rather serves as Information about what to do when your character is dynamically spawned during runtime. Some projects create their character / camera setup from code during runtime, and therefore cannot use the "Configure your own Controller" option. In this case please take a look at the Gaia API function:

    GaiaAPI.SetRuntimeCharacterAndCamera

    This static function can be called from anywhere and allows you to set up your character and camera after they were spawned. This allows you to integrate Gaia's runtime systems with a single line of code with your custom spawned character controller.


    Starter Assets Render Pipeline Support

    Both Starter Asset Controllers only show support for the Universal Rendering pipeline on the Asset Store pages:

    image.png

    However, both assets can very easily be adapted to work in Built-In or HDRP as well. For the first-person character controller to work with Gaia, NO special actions are required across the pipelines.
    For the third-person character, you will notice that its shaders / materials do not render correctly when running in Built-In or HDRP:

    image.png

    To fix this, you need to locate the materials for the 3rd person character in the Starter Assets folder:

    image.png

    These are 3 materials for arms, body and legs of the character. The materials use the URP standard shader when installed from the package. First, you need to switch them to the correct shader of your target pipeline:
    BuiltIn: "Standard"
    HDRP: "HDRP\Lit"
    Then you need to assign the matching textures in the texture slots in the material. On the example of the M_Armature_Arms material, for HDRP:

    image.png

    For Built-In:

    image.png

    Perform those changes for all 3 materials, Arms, Body and Legs. The robot character should display correctly in your pipeline:

    image.png

    The demo scenes for those controllers can be fixed in the same fashion, but this should not be required for using those controllers in Gaia.

     

     

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...