Hey! Thank you for the thorough reply! I'm not using the Bone Follower script. I think what I'm using is probably closer to the PointFollower script. I adjusted it a long time ago so I could be wrong, but I believe it's very close. Here it is:
void OnValidate(){
if (skeletonAnimation == null) skeletonAnimation = GetComponent<SkeletonAnimation>();
if (playerTransform == null) playerTransform = GetComponent<Transform>();
}
// Start is called before the first frame update
void Awake()
{
bone = skeletonAnimation.Skeleton.FindBone(boneName);
playerTransform = skeletonAnimation.transform;
Attachment attachment = skeletonAnimation.Skeleton.GetAttachment(slotName, attachmentName);
if (attachment == null){
Debug.Log("attachment not found");
return;
}
pointAttachment = attachment as PointAttachment;
if(pointAttachment == null){
Debug.Log("attachment is not a PointAttachment");
return;
}
slot = skeletonAnimation.Skeleton.FindSlot(slotName);
}
void Update()
{
horOffset = offsets.Horizontal;
verOffset = offsets.Vertical;
torsoPoint = pointAttachment.GetWorldPosition(slot, skeletonAnimation.transform);
torsoPoint = skeletonAnimation.transform.InverseTransformPoint(torsoPoint);
aimmer = new Vector3 (horOffset * 10, verOffset * 10, 0f);
if( horOffset != 0 || verOffset != 0){
if(offsets.isRight){
bone.SetLocalPosition(new Vector3(aimmer.x + torsoPoint.x, aimmer.y + torsoPoint.y, 0f));
}
else{
bone.SetLocalPosition(new Vector3(-aimmer.x + torsoPoint.x, aimmer.y + torsoPoint.y, 0f));
}
}
else{
bone.SetLocalPosition(new Vector3(10, 2.5f, 0));
}
}`
As for the code for firing the projectile, it occurs in LateUpdate() as follows:
if (Input.GetButtonDown(fireButton) && Weapon[weaponsSelector] == 0 && scriptAccess.canShoot)
{
var newfireball = fireballPool.Get();
newfireball.transform.position = pointAttachment.GetWorldPosition(slot, skelAnim.transform);
newfireball.transform.rotation = movementAngle;
newfireball.gameObject.SetActive(true);
}
I can take a look at the script execution order, but if you see anything that would obviously lead to this execution order error when disabling an activating the player gameobject in these scripts I'd be very appreciative.