unity web player code example
Example: player script unity
private Rigidbody2D RB;
public float speed = 50f;
void Start()
{
RB = GetComponent<Rigidbody2D>();
}
void Update()
{
if (Input.GetKey(KeyCode.D))
{
RB.AddForce(Vector3.right * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.A))
{
RB.AddForce(Vector3.left * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.W))
{
RB.AddForce(Vector3.up * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S))
{
RB.AddForce(Vector3.down * speed * Time.deltaTime);
}
}