Forum rules - please read before posting.

Unusual Delay during Inventory Interactions & Different Way to Switch Player

Hi! I am making a 2D decoration game with AC where you can drag items from the inventory and drop them anywhere you feel like in a room-like space. I set each item a Player and use Player: Switch to realize the function of “dragging furnitures from the inventory into the room interior”. However, I have some issues about the mechanism details.

  1. I set the room background as a Hotspot with several Inventory Interactions. In each of them, the item being dragged onto the hotspot will lead to Player: Check; if the scene-based counterpart of the selected inventory item is Current Player, the action list will teleport it from somewhere like (100, 100, 100) to the center of the frame; if not, it will operate Player: Switch and then Object: Teleport. Each interaction runs fine when I hit Run Now in Inspector during gameplay; However, when interactions run in sequence without my inspector intervention, there is at least 10-second delay between “dragging something into the room” and “actually dragging the scene-based object (Player) around”. I wonder what causes the delay.
  2. I wonder if player-switching could be achieved without putting them into the inventory, let’s say, could it be achieved with a mouse click? I am thinking if I could combine a Player and a Hotspot together, so when the item assigned with Player and Hotspot is being clicked, it switches to Current Player. By doing so, player can move any item in the room around, even when the selected item was not necessarily a Current Player.
  3. Last, as someone with very little knowledge of coding, I would like to know if 50+ switchable Players will be too heavy for AC to deal with? This game is supposed to be put on a website.

Thanks!

«1

Comments

  • This is really thoughtful.

  • Welcome to the community, @minxul.

    1. There's not enough detail here for me to see what it might be, but there are a few steps you can take to narrow things down. Is the game frozen during this time, or is the game still running at a steady frame rate? Use Unity's Profiler to find out, as well as where the issue may lie if it's frozen.

    AC's Status Box may also be helpful here, since it will list all currently-running ActionLists. It can be enabled at the bottom of the Settings Manager.

    1. You can't combine Players with Hotspots, but inactive Players can be teleported using the Player: Teleport inactive Action.

    I'm not entirely clear on your method, however. Can you share more details on what it is exactly you're trying to do, and how/why you're using Players to achieve this? The more you can share, screenshots included, the better understanding I'll have, and may be able to suggest an alternative.

    1. The number of Players defined shouldn't affect the act of switching player individually, but may increase the load when saving/loading a game. But let's hear more about the situation itself and we'll see if we can come up with something more robust.
  • Thank you for your response, @ChrisIceBox .

    1. I used Profiler and it shows that the game was running at a steady frame rate even though I failed to drag the Current Player until like 20 sec later. I recorded a video of it running so it might be easier to understand. Notice the first dragging was done in the frame of the game and having the delay issue, while the following two were done in the inspector without any issue.

    2. Sorry for any confusion caused. Basically I want to create a game like this one.

    First, player can drag an item from the inventory to the main scene and place the item freely in the scene. Second, player can drag anything in the scene anytime to place it. The third function is not in the game I showed above but what I wish to realize - when an item is being dragged, its sprite's sorting layer automatically becomes the top one in the game, so it is not covered by any other items' images. Forth (also not in the game above), when an item that's already in the scene is being clicked, there will be one small arrow around the cursor so player could choose if they want to flip the item image horizontally or not. Any advice would be appreciated.

  • Thanks for the details.

    Looks like you'd be better off with an approach similar to the "Item arranging" puzzle template over on the Downloads page.

    That template uses custom scripts to reposition Hotspots that represent inventory items when items are drag-dropped in the scene - though the inventory is hidden from view.

    Leave this with me for the moment, and I'll see if I can suggest a modified script to do something more in-line with what you're looking for.

  • edited October 2020

    OK, try this.

    Open ActionInventorySelect, and replace line 72:

    if (giveToPlayer)
    

    with:

    if (giveToPlayer && !KickStarter.runtimeInventory.PlayerInvCollection.Contains (invID))
    

    (That'll fix a small bug that'll also be fixed in the next update).

    Then, make a new C# script file named FurniturePiece.cs:

    using UnityEngine;
    
    namespace AC
    {
    
        public class FurniturePiece : MonoBehaviour
        {
    
            [SerializeField] private int associatedItemID = 0;
            private int originalOrder;
    
            void OnEnable ()
            {
                originalOrder = GetComponent<SpriteRenderer> ().sortingOrder;
    
                EventManager.OnInventorySelect += OnInventorySelect;
                EventManager.OnInventoryDeselect += OnInventoryDeselect;
            }
    
            void OnDisable ()
            {
                EventManager.OnInventorySelect -= OnInventorySelect;
                EventManager.OnInventoryDeselect -= OnInventoryDeselect;
            }
    
            void Update ()
            {
                if (KickStarter.runtimeInventory.SelectedItem != null && KickStarter.runtimeInventory.SelectedItem.id == associatedItemID)
                {
                    float cameraDepth = transform.position.z - Camera.main.transform.position.z;
                    Vector3 screenPosition = new Vector3 (KickStarter.playerInput.GetMousePosition ().x, KickStarter.playerInput.GetMousePosition ().y, cameraDepth);
                    transform.position = Camera.main.ScreenToWorldPoint (screenPosition);
                }
            }
    
            void OnInventorySelect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    GetComponent<SpriteRenderer> ().sortingOrder = 10;
                }
            }
    
            void OnInventoryDeselect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    KickStarter.runtimeInventory.Remove (associatedItemID);
                    GetComponent <SpriteRenderer>().sortingOrder = originalOrder;
                }
            }
    
        }
    
    }
    

    Create an inventory item and a sprite in the scene for each piece, and attach this component to the scene sprite. Set the Associated Item ID Inspector field to match.

    Also attach a 2D collider and Hotspot component, and have the Hotspot's Use interaction run an Inventory: Select Action to select its associated item.

    Make sure each inventory item has Carry on start? enabled, and that the sprites are hidden from the camera view to begin with. Check "Drag and drop Inventory interface?" in the Settings Manager, and you should then be able to drag the pieces from the inventory and then around the scene.

  • Sorry, I missed a couple of points related to the scene object - updated the above instructions.

  • Thank you so much @ChrisIceBox.

    I tried the method you provided, but there are still some issues. I downloaded and imported the puzzle template to my project. After following the instructions of Readme, I tested the gameplay at first without re-scripting anything but it was not functioning properly. Below is the recorded gameplay.

    Then I used the script you offer (replace line 72) and tried to run the game but it fails and shows two errors:

    Request error (error):
    UnityEditor.AsyncHTTPClient:Done(State, Int32) (at /Users/bokken/buildslave/unity/build/Editor/Mono/AsyncHTTPClient.cs:246)

    Assets/Plugins/AdventureCreator/Scripts/Actions/ActionInventorySelect.cs(72,56): error CS1061: 'RuntimeInventory' does not contain a definition for 'PlayerInvCollection' and no accessible extension method 'PlayerInvCollection' accepting a first argument of type 'RuntimeInventory' could be found (are you missing a using directive or an assembly reference?)

    ps. I am actually not sure if the first error is AC-related.

    I was thinking it's probably because that I assigned the managers wrongly so I switched the managers from the original managers of my game to ArrangingPuzzleExample Managers, but it doesn't work as well. Then I started New Project in Unity and set up all the things following the instructions of the puzzle arranging template and hit gameplay. This time the error becomes:

    NullReferenceException: Object reference not set to an instance of an object
    AC.ArrangingPuzzlePiece.Update () (at Assets/AdventureCreator/Downloads/Arranging puzzle/Scripts/ArrangingPuzzlePiece.cs:62)

    Any advice?

  • I tested the gameplay at first without re-scripting anything but it was not functioning properly.

    What of the included example scene? Let's make sure that at least that's working as intended first.

    Though, the script I wrote above is a replacement for it - you don't need the template package installed as well to try it out.

    Assets/Plugins/AdventureCreator/Scripts/Actions/ActionInventorySelect.cs(72,56): error CS1061: 'RuntimeInventory' does not contain a definition for 'PlayerInvCollection'

    This suggests you're using an old AC release. You'll need to be using the latest version of AC from the Asset Store.

    NullReferenceException: Object reference not set to an instance of an object

    This suggests you have no "Arranging Puzzle Manager" component present in your scene. See the way this is attached to the "Puzzle" GameObject in the example scene.

  • Thanks @ChrisIceBox. Errors are solved now.

    What of the included example scene? Let's make sure that at least that's working as intended first.

    When the item is dragged to the targeted slot, it does not stay in the slot. It was just like a little test of the template but it seems we don't have to worry about the issue here since the template is not necessary in the game lol.

    There is only one thing I'd like to figure out. I just set up things without using the template but could not find where I can set the associated item ID of the scene-based object. When I was using the puzzle arrange asset, I was able to find it in the inspector of arrangingitempiece, though.

  • It should be configurable in the "Furniture Piece" component's Inspector. You can change the "associatedItemID" variable from private to public, but as it's marked as serializable it should already be visible.

  • Thanks Chris @ChrisIceBox. I figured it out how to use the script correctly and now I could drag my item around the scene, but there are still some issues about the script.

    1. It seems a bit incompatible with the function I would like to achieve next. When the scene-based item is clicked but not being dragged, I want to have two options represented by two icons floating around the item - ‘flip the item horizontally’ and ‘discard’. I believe this function requires Choose Hotspot then Interaction mode, which cannot be achieved as Context Sensitive is a prerequisite for the FurniturePiece script. I have also tried using dialogue as a way to provide player with the two options, but it does not seem to work with the script, either.

    2. Is there any way to make the item remain on the top of the sorting layers when the dragging on it has just stopped? The solution I presume could be “check the largest number of currently existing items’ sorting layer (which is x) and then make the selected item’s layer x+1”. In this way, each time when a scene-based item is clicked (not necessarily being dragged), the item automatically gets a sorting layer that is on the top of all other layers. And sorry, I just realized my description of this function on 10 Oct was quite ambiguous. Here I edited an example that combines my first and second point (it was done in Photoshop so please ignore the purple guides and numbers).

    3. I am also wondering if the smaller version of the selected item which shows when an item is being dragged around could be eliminated.

      2020-10-20-6-15-06

    Truly appreciate the efforts you have made for AC users like me. Also have decided to learn some coding so at least I could write some custom actions. :)

  • edited October 2020

    1) There's no prerequisite so far as the interaction method goes - the script essentially just repositions a sprite in the scene whenever a given inventory item is selected.

    Items can still be selected in "Choose Hotspot Then Interaction" mode, but it requires that you click on an Interaction icon to do so. You can either set this up manually, so that a given Inventory interaction runs the Inventory: Select Action, or configure the Settings Manager to automatically select an item if a given interaction icon is unhandled.

    What you can't do at the moment, however, is drag-drop an item before showing an Interaction menu - but I shall look into this as a possible option.

    2) Yes, this is possible - find an updated script below.

    3) In your Cursor Manager, set your When inventory selected property to Change Hotspot Label.

    using UnityEngine;
    
    namespace AC
    {
    
        public class FurniturePiece : MonoBehaviour
        {
    
            [SerializeField] private int associatedItemID = 0;
            private FurniturePiece[] allPieces;
    
            void OnEnable ()
            {
                EventManager.OnInventorySelect += OnInventorySelect;
                EventManager.OnInventoryDeselect += OnInventoryDeselect;
            }
    
            void OnDisable ()
            {
                EventManager.OnInventorySelect -= OnInventorySelect;
                EventManager.OnInventoryDeselect -= OnInventoryDeselect;
            }
    
            void Start ()
            {
                allPieces = Object.FindObjectsOfType <FurniturePiece>();
            }
    
            void Update ()
            {
                if (KickStarter.runtimeInventory.SelectedItem != null && KickStarter.runtimeInventory.SelectedItem.id == associatedItemID)
                {
                    float cameraDepth = transform.position.z - Camera.main.transform.position.z;
                    Vector3 screenPosition = new Vector3 (KickStarter.playerInput.GetMousePosition ().x, KickStarter.playerInput.GetMousePosition ().y, cameraDepth);
                    transform.position = Camera.main.ScreenToWorldPoint (screenPosition);
                }
            }
    
            void OnInventorySelect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    GetComponent<SpriteRenderer> ().sortingOrder = 10;
                }
            }
    
            void OnInventoryDeselect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    int maxOrder = 0;
                    foreach (FurniturePiece piece in allPieces)
                    {
                        if (piece == this) continue;
                        maxOrder = Mathf.Max (maxOrder, piece.GetComponent <SpriteRenderer>().sortingOrder);
                    }
    
                    KickStarter.runtimeInventory.Remove (associatedItemID);
                    GetComponent <SpriteRenderer>().sortingOrder = maxOrder + 1;
                }
            }
    
        }
    
    }
    
  • @ChrisIceBox Great! Thank you so much Chris!

  • Hi Chris @ChrisIceBox. I am just wondering if it is possible to make each inventory item Can carry multiple. It seems that with the current FurniturePiece script, whenever I move an item (A) out of inventory, there immediately be no Item A left even though the amount is set to 10. I assume that there could be a solution - each time Item A is dragged out from inventory but not for the first time, there will be a duplicate of the scene-based counterpart of Item A; and each of them could be dragged around. I am not sure if this is too complicated to code, though.

    Also, there are two further questions.
    1. Is it possible to show the description of an inventory item when the mouse is hovering over it in the inventory interface with Context Sensitive mode?
    2. I am thinking about ways of flipping scene-based item’s sprite horizontally, which I am certain will require some custom script. The first method I came up with is, a double click (let’s say two clicks with less than 1 sec interval) on the object (the collider, I guess?) will trigger an action that flips the sprite horizontally. My second assumption is, dragging the object onto a hotspot could be set to trigger an action that flips the sprite.

    I understand this might involve a lot of coding work, so any advice (like which method works better for a certain function) is appreciated.

  • ps. the second question is based on Context Sensitive method being used.

  • edited November 2020

    I am just wondering if it is possible to make each inventory item Can carry multiple.

    Yes - the script above will remove all instances of a given item upon deselection. The one below will just remove one:

    using UnityEngine;
    
    namespace AC
    {
    
        public class FurniturePiece : MonoBehaviour
        {
    
            [SerializeField] private int associatedItemID = 0;
            private FurniturePiece[] allPieces;
    
            void OnEnable ()
            {
                EventManager.OnInventorySelect += OnInventorySelect;
                EventManager.OnInventoryDeselect_Alt += OnInventoryDeselect;
            }
    
            void OnDisable ()
            {
                EventManager.OnInventorySelect -= OnInventorySelect;
                EventManager.OnInventoryDeselect_Alt -= OnInventoryDeselect;
            }
    
            void Start ()
            {
                allPieces = Object.FindObjectsOfType <FurniturePiece>();
            }
    
            void Update ()
            {
                if (KickStarter.runtimeInventory.SelectedItem != null && KickStarter.runtimeInventory.SelectedItem.id == associatedItemID)
                {
                    float cameraDepth = transform.position.z - Camera.main.transform.position.z;
                    Vector3 screenPosition = new Vector3 (KickStarter.playerInput.GetMousePosition ().x, KickStarter.playerInput.GetMousePosition ().y, cameraDepth);
                    transform.position = Camera.main.ScreenToWorldPoint (screenPosition);
                }
            }
    
            void OnInventorySelect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    GetComponent<SpriteRenderer> ().sortingOrder = 10;
                }
            }
    
            void OnInventoryDeselect (InvCollection invCollection, InvInstance invInstance)
            {
                if (invInstance.ItemID == associatedItemID)
                {
                    int maxOrder = 0;
                    foreach (FurniturePiece piece in allPieces)
                    {
                        if (piece == this) continue;
                        maxOrder = Mathf.Max (maxOrder, piece.GetComponent <SpriteRenderer>().sortingOrder);
                    }
    
                    invCollection.Delete (invInstance, 1);
                    GetComponent <SpriteRenderer>().sortingOrder = maxOrder + 1;
                }
            }
    
        }
    
    }
    

    Is it possible to show the description of an inventory item when the mouse is hovering over it in the inventory interface with Context Sensitive mode?

    Yes - you can read the value of KickStarter.runtimeInventory.hoverItem to check which item is being hovered-over - though what you do with this depends on how you're setting your description (an item property?) and where you're showing it. What's your intent?

    I am thinking about ways of flipping scene-based item’s sprite horizontally

    What's your preferred method, so far as the user goes? The simplest way would be to add a Hotspot to the Item's "Linked prefab" (which supports double-clicking), and hook into the OnHotspotInteract event to flip the SpriteRenderer:

    using UnityEngine;
    
    namespace AC
    {
    
        public class Flipper : MonoBehaviour
        {
    
            void OnEnable ()
            {
                EventManager.OnHotspotInteract += OnHotspotInteract;
            }
    
            void OnDisable ()
            {
                EventManager.OnHotspotInteract -= OnHotspotInteract;
            }
    
            void OnHotspotInteract (Hotspot hotspot, AC.Button button)
            {
                if (hotspot == GetComponent <Hotspot>())
                {
                    GetComponent <SpriteRenderer>().flipX = !GetComponent <SpriteRenderer>().flipX;
                }
            }
    
        }
    
    }
    
  • Thanks @ChrisIceBox

    Yes - the script above will remove all instances of a given item upon deselection. The one below will just remove one

    I tried this but the console shows:
    Assets/Plugins/AdventureCreator/FurniturePiece.cs(21,49): error CS0123: No overload for 'OnInventoryDeselect' matches delegate 'EventManager.Delegate_Inventory'

    Yes - you can read the value of KickStarter.runtimeInventory.hoverItem to check which item is being hovered-over - though what you do with this depends on how you're setting your description (an item property?) and where you're showing it. What's your intent?

    I would like to show some textual description in a dialogue box on the lower side of the screen when the mouse is hovering on an inventory item, just like a regular dialogue.

    What's your preferred method, so far as the user goes? The simplest way would be to add a Hotspot to the Item's "Linked prefab" (which supports double-clicking), and hook into the OnHotspotInteract event to flip the SpriteRenderer.

    Yes I think the way you suggest should work! Also, I am really sorry that I just realized that I need to flip the 2D collider of the selected object as well when I flip the sprite, which needs negative Transform.scale to be used as Unity documentation says.

  • Also, I just noticed that when I drag items around, some of them will be covered by other objects already in the scene; when the mouse is released, they appear on the top of other objects again, like what the video shows. I wonder if it is possible to make the sprite of the selected item on the top of all sprites once it is being dragged around instead of being released from dragging.

  • I tried this but the console shows

    My mistake - I've corrected it below.

    I would like to show some textual description in a dialogue box on the lower side of the screen when the mouse is hovering on an inventory item, just like a regular dialogue.

    In your Inventory Manager's Properties tab, create a new String Property named Description. You can then enter in a Description for each item back in the Items tab.

    To display this text as speech when hovering over items, make a note of the Property's ID number and plug it into the Inspector of this script, placed in the scene with the others:

    using UnityEngine;
    using AC;
    
    public class ShowItemDescription : MonoBehaviour
    {
    
        public int propertyID;
    
        private void OnEnable () { EventManager.OnMouseOverMenu += OnMouseOverMenu; }
        private void OnDisable () { EventManager.OnMouseOverMenu -= OnMouseOverMenu; }
    
        private void OnMouseOverMenu (AC.Menu _menu, MenuElement _element, int _slot)
        {
            if (_element != null && _element is MenuInteraction)
            {
                MenuInventoryBox inventoryBox = _element as MenuInventoryBox;
                InvItem invItem = inventoryBox.GetItem (_slot);
                if (invItem != null)
                {
                    string description = invItem.GetProperty (propertyID).TextValue;
                    if (!string.IsNullOrEmpty (description))
                    {
                        KickStarter.dialog.EndSpeechByCharacter (null);
                        KickStarter.dialog.StartDialog (null, description);
                    }
                }
            }
        }
    
    }
    

    I need to flip the 2D collider of the selected object as well when I flip the sprite, which needs negative Transform.scale

    using UnityEngine;
    
    namespace AC
    {
    
        public class Flipper : MonoBehaviour
        {
    
            void OnEnable () { EventManager.OnHotspotInteract += OnHotspotInteract; }
            void OnDisable () { EventManager.OnHotspotInteract -= OnHotspotInteract; }
    
            void OnHotspotInteract (Hotspot hotspot, AC.Button button)
            {
                if (hotspot == GetComponent <Hotspot>())
                {
                    Vector3 newScale = transform.localScale;
                    newScale.x *= -1f;
                    transform.localScale = newScale;
                }
            }
    
        }
    
    }
    

    I wonder if it is possible to make the sprite of the selected item on the top of all sprites once it is being dragged around instead of being released from dragging.

    using UnityEngine;
    
    namespace AC
    {
    
        public class FurniturePiece : MonoBehaviour
        {
    
            [SerializeField] private int associatedItemID = 0;
            private FurniturePiece[] allPieces;
    
            void OnEnable ()
            {
                EventManager.OnInventorySelect += OnInventorySelect;
                EventManager.OnInventoryDeselect_Alt += OnInventoryDeselect;
            }
    
            void OnDisable ()
            {
                EventManager.OnInventorySelect -= OnInventorySelect;
                EventManager.OnInventoryDeselect_Alt -= OnInventoryDeselect;
            }
    
            void Start ()
            {
                allPieces = Object.FindObjectsOfType <FurniturePiece>();
            }
    
            void Update ()
            {
                if (KickStarter.runtimeInventory.SelectedItem != null && KickStarter.runtimeInventory.SelectedItem.id == associatedItemID)
                {
                    float cameraDepth = transform.position.z - Camera.main.transform.position.z;
                    Vector3 screenPosition = new Vector3 (KickStarter.playerInput.GetMousePosition ().x, KickStarter.playerInput.GetMousePosition ().y, cameraDepth);
                    transform.position = Camera.main.ScreenToWorldPoint (screenPosition);
                }
            }
    
            void OnInventorySelect (InvItem item)
            {
                if (item.id == associatedItemID)
                {
                    int maxOrder = 0;
                    foreach (FurniturePiece piece in allPieces)
                    {
                        if (piece == this) continue;
                        maxOrder = Mathf.Max (maxOrder, piece.GetComponent <SpriteRenderer>().sortingOrder);
                    }
    
                    GetComponent <SpriteRenderer>().sortingOrder = maxOrder + 1;
                }
            }
    
            void OnInventoryDeselect (InvCollection invCollection, InvInstance invInstance)
            {
                if (invInstance.ItemID == associatedItemID)
                {
                    invCollection.Delete (invInstance, 1);
                }
            }
    
        }
    
    }
    
  • Thanks! @ChrisIceBox

    My mistake - I've corrected it below.

    The new script worked well in terms of keeping items on the top sorting layer when they are being dragged, but still seems not consistent with the Can carry multiple option, and after a few secs of gameplay the console shows this error and the game gets frozen:
    NullReferenceException: Object reference not set to an instance of an object
    AC.FurniturePiece.OnInventoryDeselect (AC.InvCollection invCollection, AC.InvInstance invInstance) (at Assets/Plugins/AdventureCreator/FurniturePiece.cs:58)
    AC.EventManager.Call_OnChangeInventory (AC.InvCollection invCollection, AC.InvInstance invInstance, AC.InventoryEventType inventoryEventType, System.Int32 amountOverride) (at Assets/Plugins/AdventureCreator/Scripts/Managers/EventManager.cs:1419)
    AC.RuntimeInventory.SetNull () (at Assets/Plugins/AdventureCreator/Scripts/Inventory/RuntimeInventory.cs:118)
    AC.PlayerInteraction+d__35.MoveNext () (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:1369)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AC.PlayerInteraction:ClickButton(InteractionType, Int32, InvInstance, Hotspot) (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:1033)
    AC.PlayerInteraction:HandleInteraction() (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:762)
    AC.PlayerInteraction:ContextSensitiveClick() (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:608)
    AC.PlayerInteraction:HandleInteractionMenu() (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:197)
    AC.PlayerInteraction:UpdateInteraction() (at Assets/Plugins/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:124)
    AC.StateHandler:Update() (at Assets/Plugins/AdventureCreator/Scripts/Game engine/StateHandler.cs:205)

    Here is an example, notice the yellow bed's amount is set to 10.

    In your Inventory Manager's Properties tab, create a new String Property named Description. You can then enter in a Description for each item back in the Items tab.

    To display this text as speech when hovering over items, make a note of the Property's ID number and plug it into the Inspector of this script, placed in the scene with the others:

    I tried this but it does not work for some reason... Everything is set up well except the speech does not show in the scene when the item is being hovered over.



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.