I try to do football game for fun but i got a problem
void OnTriggerStay(Collider other)
{
if (other.tag == "BallTAG")
RpcAddForceToBall(other.gameObject);
}
[ClientRpc]
public void RpcAddForceToBall(GameObject hit)
{
if (Input.GetButton("Drag"))
{
hit.GetComponent<Rigidbody>().AddForce((movement * 200) * Time.deltaTime);
}
if (Input.GetButtonDown("Shoot"))
hit.GetComponent<Rigidbody>().AddForce((new Vector3(movement.x, 0.60f, movement.z) * 2000 * PlayerCC.velocity.magnitude) * Time.deltaTime);
}
}
host can drag or shoot but client can't do something to ball. but if i do like that
void OnTriggerStay(Collider other)
{
hit.GetComponent<Rigidbody>().AddForce(10,10,10);
if (other.tag == "BallTAG")
RpcAddForceToBall(other.gameObject);
}
client can do force to ball
also i do that too
void OnTriggerStay(Collider other)
{
Debug.Log("Entered");
if (Input.GetButton("Drag"))
Debug.Log("Dragging");
}
still can print Entered on Client but dragging isn't host can print both of them
What can i do for fix that?