Hi. I have this script attached to spear object, it's supposed to stick to networked golf balls but it displays warning "parent was set without calling SetParent. Use networkObject.SetParent(obj) to assign a NetworkObject a new parent. This is being made a requirement in Fish-Networking v4" and does not really work.
public class StickToGround : NetworkBehaviour
{
[SerializeField] private Rigidbody rb;
private bool hasCollided = false;
private void OnTriggerEnter(Collider other)
{
if (hasCollided) return;
hasCollided = true;
if (other.TryGetComponent<NetworkTransform>(out var nt))
{
NetworkObject.SetParent(nt);
}
else
{
rb.isKinematic = true;
}
}
}