It seems like a simple task, you need to determine whether the horse is under the saddle or not, but no matter how hard I tried, I still couldn’t understand how this is done, here is my code for the forum:
RaycastHit hit;
if (UnityEngine.Physics.Raycast(player.eyes.HeadRay(), out hit))
{
BaseEntity entity = hit.GetEntity();
var myhorse = entity.GetComponent<RidableHorse>();
if (entity != null && entity.name.Contains("testridablehorse"))
{
if (int.Parse(dataFile["Horses"].ToString()) <= 61)
{
entity.Kill();
}
}
}