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

REMEMBER: This suggestions for the FPSController and/or ThirdPerson Controller parts for disabling found within this disable manager ARE ONLY EXAMPLES of how to do it or if you're using the Unity Standard Assets controllers, if you're using one of your own. It will need editing. Email me if you have any issues at all!

First Person Variables

Third Person Variables

Generic Variables

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