[Further Instructions on the Bank Functions]
A. in ‘PlayerBankingState.cs’, I made a few changes in ‘Exit()’:
public override void Exit()
{
Debug.Log("Player Exited Banking State");
target.CloseBank(stateMachine);
target.OtherInventoryClosed -= OnOtherInventoryClosed;
}
B. In ‘OtherInventory.cs’, I made the following changes:
public void CloseBank(PlayerStateMachine player)
{
player.GetComponent<BankAction>().Cancel();
}
C. in ‘BankAction.cs’, I changed the ‘Cancel()’ function a bit:
public void Cancel()
{
target = null;
ThirdPersonShowHideUI.CloseAllWindows();
}
D. in ‘ThirdPersonShowHideUI.cs’, I added this function:
public static void CloseAllWindows()
{
foreach (ThirdPersonShowHideUI tpShowHideUI in FindObjectsOfType<ThirdPersonShowHideUI>())
{
tpShowHideUI.UIContainer.SetActive(false);
if (tpShowHideUI.otherInventoryUI != null)
{
tpShowHideUI.otherInventoryContainer.SetActive(false);
}
}
}
[PROBLEMS]
- Something to do with the InputReader.cs, I believe…:
MissingComponentException while executing 'performed' callbacks of 'UI/Bank[/Keyboard/x]'
UnityEngine.InputSystem.LowLevel.NativeInputRuntime/<>c__DisplayClass7_0:<set_onUpdate>b__0 (UnityEngineInternal.Input.NativeInputUpdateType,UnityEngineInternal.Input.NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate (UnityEngineInternal.Input.NativeInputUpdateType,intptr)
- Another one, this one has something to do with ‘Mover.cs’ trying to access the NavMeshAgent I believe…:
MissingComponentException: There is no 'NavMeshAgent' attached to the "Player" game object, but a script is trying to access it.
You probably need to add a NavMeshAgent to the game object "Player". Or your script needs to check if the component is attached before using it.
RPG.Movement.Mover.Cancel () (at Assets/Project Backup/Scripts/Movement/Mover.cs:115)
RPG.ResourceManager.ResourceGatherer.Cancel () (at Assets/Project Backup/Scripts/ResourceManager/ResourceGatherer.cs:208)
RPG.Core.ActionSchedular.StartAction (RPG.Core.IAction action) (at Assets/Project Backup/Scripts/Core/ActionSchedular.cs:32)
RPG.Bank.BankAction.StartBankAction (UnityEngine.Transform bankTarget, System.Action callback) (at Assets/Project Backup/Scripts/Bank/BankAction.cs:30)
GameDevTV.Inventories.OtherInventory.OpenBank (RPG.States.Player.PlayerStateMachine player) (at Assets/GameDev.tv Assets/Scripts/Inventories/OtherInventory.cs:20)
PlayerBankingState.Enter () (at Assets/Project Backup/Scripts/State Machines/Player/PlayerBankingState.cs:18)
RPG.States.StateMachine.SwitchState (RPG.States.State newState) (at Assets/Project Backup/Scripts/State Machines/StateMachine.cs:13)
RPG.States.Player.PlayerFreeLookState.InputReader_HandleBankingEvent () (at Assets/Project Backup/Scripts/State Machines/Player/PlayerFreeLookState.cs:198)
RPG.InputReading.InputReader.OnBank (UnityEngine.InputSystem.InputAction+CallbackContext context) (at Assets/Project Backup/Scripts/Input Controls/InputReader.cs:197)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.CallbackArray`1[System.Action`1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at Library/PackageCache/com.unity.inputsystem@1.5.1/InputSystem/Utilities/DelegateHelpers.cs:46)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
[IGNORE THIS ONE, IT DOESN’T HAPPEN THIS OFTEN ANYMORE]
and 3. When I use my Construction System, having this line in ‘PlayerFreeLookState.InputReader_HandleBankingEvent’ means I cannot properly exit my construction and re-activate my ‘PlayerStateMachine’. In other words, my player does not safely land from the other controller… What does this line have to do with anything?:
private void InputReader_HandleBankingEvent()
{
stateMachine.SwitchState(new PlayerBankingState(stateMachine, stateMachine.BankFinder.GetNearestBank()));
}
I don’t know why the last one no longer happens, but I could’ve sworn that it used to happen…
[THE MOST IMPORTANT PROBLEM OF ALL]
AND THE BIGGEST PROBLEM OF ALL: THE LONGER YOU USE THE BANK, THE SLOWER IT GETS… How do we optimize and speed up this process further, and more importantly, how do we delete any unwanted data once the bank is done and dusted, to free up space for future data that’ll need it? It’s a serious pain to deal with (any chance we can minimize the number of items being dealt with in ‘InventoryUI.Redraw’? Wouldn’t that help it out a bit further? I know we don’t need to destroy and re-instantiate each slot, so… how do we only do that for the slots being changed?)