Step 5 - Disable Manager

Add the Disable Manager

Add the "AK_DisableManager" from the prefabs folder or the "Adventure_Kit_Managers" pack to add all to the hierarchy. You can add the "AK_DisableManager" script to an empty gameobject if you want to start fresh

Referencing the Disable Manager

//Add this namespace to the top of the script to reference the adventure kit
using AdventurePuzzleKit;
//This will disable the Player when you open the inventory
AKDisableManager.instance.DisablePlayerInventory(true);

//This will disable the Player when you open a keypad
AKDisableManager.instance.DisablePlayerKeypad(true);

//This will disable the default player 
AKDisableManager.instance.DisablePlayer(true);

//This will disable the Player when you examine an item
AKDisableManager.instance.DisablePlayerExamine(true);
AKDisableManager.instance.DisablePlayerInventory(false);

AKDisableManager.instance.DisablePlayerKeypad(false);

AKDisableManager.instance.DisablePlayer(false);

AKDisableManager.instance.DisablePlayerExamine(false);

Basic setup for the Disable Manager

First Person Variables

IsFirstPerson

Tick this box if you're using an FPSController of some sort

Player

Add the "FPSController" gameobject to this slot

Third Person Variables

IsThirdPerson

Tick this box if you're using a ThirdPersonController

ThirdPersonController

Add the "ThirdPersonController" gameobject to this slot

ThirdPersonRotator

Add the "Simple Mouse Rotator" by adding the Main Camera to this slot

Generic Variables

Crosshair

Add the "CrosshairUI" image from the "Crosshair_Canvas"

Raycast Manager

Add the "AdventureKitRaycast" by adding the Main Camera to this slot

Blur

Add the "BlurOptimized" by adding the Main Camera to this slot

Code Snippet Example:

public void DisablePlayerExamine(bool disable)
        {
            if (disable)
            {
                raycastManager.enabled = false;
                ShowCursor(true);
                AKUIManager.instance.isInteracting = true;
                crosshair.enabled = false;
                blur.enabled = true;

                if (isFirstPerson)
                {
                    player.enabled = false;
                }

                if (isThirdPerson)
                {
                    thirdPersonController.enabled = false;
                    thirdPersonRotator.enabled = false;
                }
            }
            else
            {
                raycastManager.enabled = true;
                ShowCursor(false);
                AKUIManager.instance.isInteracting = false;
                crosshair.enabled = true;
                blur.enabled = false;

                if (isFirstPerson)
                {
                    player.enabled = true;
                }

                if (isThirdPerson)
                {
                    thirdPersonController.enabled = true;
                    thirdPersonRotator.enabled = true;
                }
            }
        }

Last updated

Was this helpful?