Hello every one.
I noticed in the Brian’s course that the icon for pickupable item desapear.
It’s normal, we remove the ClickablePickup.cs file from our prefabs by remplacing it by the PickupTarget.cs script.
A way I found consist in keep the old script in your Main prefab (normally called default Pickup in the course) but lighten it by becoming this script:
using GameDevTV.Inventories;
using RPG.Movement;
using UnityEngine;
namespace RPG.Control
{
[RequireComponent(typeof(Pickup))]
public class ClickablePickup : MonoBehaviour, IRaycastable
{
Pickup pickup;
private void Awake()
{
pickup = GetComponent<Pickup>();
}
public CursorType GetCursorType()
{
if (pickup.CanBePickedUp())
{
return CursorType.Pickup;
}
else
{
return CursorType.FullPickup;
}
}
public bool HandleRaycast(PlayerController callingController)
{
return true;
}
}
}
I removed the OnTriggerEnter method, and the test condition in the bool HandlerRaycast by letting only the return true.
Now your cursor will change when you cursor wil hover an item on the floor.
All your pickup must have this “new” script so put it in your main one.
Hoping it helps.
François