Here is an example, notice the yellow bed's amount is set to 10.
The video's quality is too low for me to make out any numbers on the items, but this amended script should prevent the error:
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 (invCollection != null && invInstance.ItemID == associatedItemID) { invCollection.Delete (invInstance, 1); } } } }
Everything is set up well except the speech does not show in the scene when the item is being hovered over.
The item's property ID is not 51, but 0.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The video's quality is too low for me to make out any numbers on the items, but this amended script should prevent the error:
using UnityEngine;
The item's property ID is not 51, but 0.