Forum rules - please read before posting.

Inventory objects dissapear after closing inventory window

Hello, I followed the Adventure Creator: First-Person tutorial to create a custom inventory. Everything seems to be working fine, but when I close the inventory, the selected item disappears. I have looked for a checkbox in the options but couldn't find anything. In the tutorial video, the player selects an item, closes the inventory, and the item remains active during gameplay. Can you help me solve this issue?

Comments

  • Does closing the Inventory involve running and gameplay-blocking ActionLists?

    To help try to find the cause of the de-selection, use the Events Editor to create an Inventory / Deselect event, which runs an ActionList: Comment Action that prints out e.g. "Item deselected" to the Console. What is the message that appears in full (stacktrace included)?

  • Hi Chris,

    This is the debug message:

    Item Deselected
    (From Action #0 in ActionList 'OnInventoryDeselect')
    
     -> AC debug logger
    UnityEngine.Debug:Log (object,UnityEngine.Object)
    AC.ACDebug:Log (object,AC.ActionList,AC.Action,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/Static/ACDebug.cs:72)
    AC.Action:Log (string,UnityEngine.Object) (at Assets/AdventureCreator/Scripts/ActionList/Action.cs:1772)
    AC.ActionComment:Run () (at Assets/AdventureCreator/Scripts/Actions/ActionComment.cs:54)
    AC.ActionList/<RunAction>d__46:MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:466)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    AC.ActionList:ProcessAction (int) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:408)
    AC.RuntimeActionList:BeginActionList (int,bool) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:181)
    AC.ActionList:Interact (int,bool) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:279)
    AC.RuntimeActionList:DownloadActions (AC.ActionListAsset,AC.Conversation,int,bool,bool,bool) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:136)
    AC.AdvGame:RunActionListAsset (AC.ActionListAsset,AC.Conversation,int,bool,bool) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:242)
    AC.AdvGame:RunActionListAsset (AC.ActionListAsset,int,int) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:163)
    AC.ActionListAsset:Interact () (at Assets/AdventureCreator/Scripts/ActionList/ActionListAsset.cs:545)
    AC.EventBase:Run (object[]) (at Assets/AdventureCreator/Scripts/Events/EventBase.cs:126)
    AC.EventInventorySelect:OnInventoryDeselect (AC.InvCollection,AC.InvInstance) (at Assets/AdventureCreator/Scripts/Events/Events/EventInventorySelect.cs:60)
    AC.EventManager:Call_OnChangeInventory (AC.InvCollection,AC.InvInstance,AC.InventoryEventType,int) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:1719)
    AC.RuntimeInventory:SetNull () (at Assets/AdventureCreator/Scripts/Inventory/RuntimeInventory.cs:114)
    AC.PlayerInteraction:UpdateInventory () (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:259)
    AC.StateHandler:Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:263)
    

    And this is how I close the inventory:


    When I used the default inventory (the one hidden at the top of the screen), it was working fine. After selecting the object, the mouse took the image of the inventory asset. But now no:

    1. I press the toggle button to open the inventory.
    2. I select the item.
    3. The item-selected image replaces the default cursor.
    4. I press the toggle button to close the inventory.
    5. The cursor goes back to the default one and the game is back to lock the cursor in the center of the screen. (but in the debug console it still doesn't show that it has been deselected.)
    6. I open the inventory again. The default cursor is replaced by the item selected.
    7. I close again the inventory.
    8. Again the cursor switches to the default one, locked in the center of the screen.
    9. I click the right button of the mouse. The debug message is now displayed.
  • Ok, I found the problem. (2min after the post above)

    I had enabled the 'Hide Cursor when locked in the screen's center' option in the Interface Settings. However, if I disable this option, the Windows cursor appears over the custom cursor. Is there a way to prevent this from happening or does it only occur in editor mode?"

  • The system cursor should only be visible in the Editor, yes. You can hide it here, too, by unchecking Always show system cursor in Editor? in the Cursor Manager.

  • Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.