Here is the related code:
Debug.Log(InventoryManager.Instance.From + "This is my from right now");
if (InventoryManager.Instance.HoverObject != null)
{
Vector2 position;
RectTransformUtility.ScreenPointToLocalPointInRectangle(InventoryManager.Instance.Canvas.transform as RectTransform, Input.mousePosition, null, out position);
position.Set(position.x, position.y - hoverYOffset);
InventoryManager.Instance.HoverObject.transform.position = InventoryManager.Instance.Canvas.transform.TransformPoint(position);
}
if (Input.GetMouseButtonUp (0))
{
Debug.Log(InventoryManager.Instance.From + "This is my from after clicking");
if (!isMouseOver && InventoryManager.Instance.From != null)...
Somehow that first debug line comes back as SlotType, which is expected behavior after I select an item from the inventory window. Without doing anything else, I click away from the inventory window and suddenly InventoryManager.Instance.From is null!
Worse, this problem sometimes resolves itself after I have been playing for a little while, but not on every run of the game. I am so confused right now what could possibly be happening.
All of this code is inside of my Update function.
Apologies for my code formatting, I’m not sure why that line won’t indent for me.