I have seen quill18creates’s video on this topic :
BUT
My project isn’t using Photon nor is it using C# so quill18create’s video didn’t really help me at all.
Can someone send me a link to a Javascript tutorial for this prediction system without photon please.
Thank you.
420BlazeIt:
I have seen quill18creates’s video on this topic :
https://www.youtube.com/watch?v=oZ7TQjWhtEw
BUT
My project isn’t using Photon nor is it using C# so quill18create’s video didn’t really help me at all.
Can someone send me a link to a Javascript tutorial for this prediction system without photon please.
Thank you.
Are you using the standard Unity networking?
420BlazeIt:
Yes.
Sorry for the late reply. I followed the same tutorial in my game, and this is what I did. I can’t say 100% this works because I removed some of the code pertaining to synced animations since I haven’t fulled fixed that yet.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(CharacterController))]
[RequireComponent(typeof(NetworkView))]
public class FirstPersonController : MonoBehaviour {
public float defaultFieldOfView;
public float walkSpeed;
public float sprintSpeed;
public float mouseSensitivityX;
public float mouseSensitivityY;
public float headTiltMinimum;
public float headTiltMaximum;
public float jumpHeight;
public float staminaEnergyUsage;
public float staminaEnergyGain;
public float staminaCapacity;
public float staminaGainDelay;
public float staminaUseFOV;
public float maxHealth;
public float currentHealth;
private float rotUpDown = 0;
private float verticalVelocity = 0;
private bool canUseStamina = true;
private float staminaTime = 0;
private CharacterController cc;
private bool screenLock = true;
// Network Sync
private float lastSynchronizationTime = 0f;
private float syncDelay = 0f;
private float syncTime = 0f;
private Vector3 syncStartPosition = Vector3.zero;
private Vector3 syncEndPosition = Vector3.zero;
private Quaternion syncRotStart = Quaternion.identity;
private Quaternion syncRotEnd = Quaternion.identity;
void Start () {
Screen.lockCursor = true;
cc = GetComponent<CharacterController>();
}
void OnGUI()
{
GUI.Box (new Rect (32, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 4) - 8, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 2) - 16, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (3 * Screen.width / 4) - 24, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
}
public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
Vector3 syncPosition = Vector3.zero;
Quaternion syncRotation = Quaternion.identity;
Vector3 syncVelocity = Vector3.zero;
if (stream.isWriting)
{
syncPosition = transform.position;
stream.Serialize(ref syncPosition);
syncRotation = transform.rotation;
stream.Serialize(ref syncRotation);
syncVelocity = GetComponent<CharacterController>().velocity;
stream.Serialize(ref syncVelocity);
}
else
{
stream.Serialize(ref syncPosition);
stream.Serialize(ref syncRotation);
stream.Serialize(ref syncVelocity);
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
syncEndPosition = syncPosition + syncVelocity * syncDelay;
syncStartPosition = transform.position;
syncRotEnd = syncRotation;
syncRotStart = transform.rotation;
}
}
public void SyncedMovement()
{
syncTime += Time.deltaTime;
transform.position = Vector3.Lerp(syncStartPosition, syncEndPosition, syncTime / syncDelay);
transform.rotation = Quaternion.Lerp (syncRotStart, syncRotEnd, syncTime / syncDelay);
}
void OnApplicationFocus(bool focusStatus)
{
if (focusStatus)
{
if (screenLock)
{
Screen.lockCursor = true;
}
}
}
void Update () {
if (networkView.isMine)
{
UpdateMovement();
}
else
{
SyncedMovement();
}
}
private void UpdateMovement()
{
// Rotation
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivityX;
transform.Rotate(0, rotLeftRight, 0);
rotUpDown -= Input.GetAxis("Mouse Y") * mouseSensitivityY;
rotUpDown = Mathf.Clamp (rotUpDown, -headTiltMinimum, headTiltMaximum);
Camera.main.transform.localRotation = Quaternion.Euler (rotUpDown, 0, 0);
// Movement and Jumping
float desiredSpeed = walkSpeed;
if (Input.GetKey("w") || Input.GetKey("a") || Input.GetKey("s") || Input.GetKey("d"))
{
walk = true;
}
else
{
walk = false;
}
if (Input.GetButton("Sprint") && staminaCapacity > 0 && canUseStamina) // Sprint
{
sprint = true;
desiredSpeed = sprintSpeed;
staminaCapacity -= staminaEnergyUsage/2;
if (staminaCapacity <= 0)
{
staminaTime = Time.time;
}
}
else
{
sprint = false;
if (staminaCapacity < 100 && ((Time.time - staminaTime) >= staminaGainDelay))
{
if ((staminaCapacity += staminaEnergyGain) > 100)
{
staminaCapacity = 100;
}
else
{
staminaCapacity += staminaEnergyGain;
}
}
}
if (sprint)
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, staminaUseFOV, Time.deltaTime * 10);
}
else
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, defaultFieldOfView, Time.deltaTime * 10);
}
float forwardSpeed = Input.GetAxis("Vertical") * desiredSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * desiredSpeed;
verticalVelocity += Physics.gravity.y * Time.deltaTime;
if (Input.GetButtonDown("Jump") && cc.isGrounded)
{
verticalVelocity = jumpHeight;
}
Vector3 speed = new Vector3(sideSpeed, verticalVelocity, forwardSpeed);
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime);
}
}
EDIT: My mistakes. You wanted JavaScript not C#. There’s also on OnGUI in there that you can remove if you still plan on using this.
StickyKeyStudios:
Sorry for the late reply. I followed the same tutorial in my game, and this is what I did. I can’t say 100% this works because I removed some of the code pertaining to synced animations since I haven’t fulled fixed that yet.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(CharacterController))]
[RequireComponent(typeof(NetworkView))]
public class FirstPersonController : MonoBehaviour {
public float defaultFieldOfView;
public float walkSpeed;
public float sprintSpeed;
public float mouseSensitivityX;
public float mouseSensitivityY;
public float headTiltMinimum;
public float headTiltMaximum;
public float jumpHeight;
public float staminaEnergyUsage;
public float staminaEnergyGain;
public float staminaCapacity;
public float staminaGainDelay;
public float staminaUseFOV;
public float maxHealth;
public float currentHealth;
private float rotUpDown = 0;
private float verticalVelocity = 0;
private bool canUseStamina = true;
private float staminaTime = 0;
private CharacterController cc;
private bool screenLock = true;
// Network Sync
private float lastSynchronizationTime = 0f;
private float syncDelay = 0f;
private float syncTime = 0f;
private Vector3 syncStartPosition = Vector3.zero;
private Vector3 syncEndPosition = Vector3.zero;
private Quaternion syncRotStart = Quaternion.identity;
private Quaternion syncRotEnd = Quaternion.identity;
void Start () {
Screen.lockCursor = true;
cc = GetComponent<CharacterController>();
}
void OnGUI()
{
GUI.Box (new Rect (32, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 4) - 8, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 2) - 16, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (3 * Screen.width / 4) - 24, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
}
public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
Vector3 syncPosition = Vector3.zero;
Quaternion syncRotation = Quaternion.identity;
Vector3 syncVelocity = Vector3.zero;
if (stream.isWriting)
{
syncPosition = transform.position;
stream.Serialize(ref syncPosition);
syncRotation = transform.rotation;
stream.Serialize(ref syncRotation);
syncVelocity = GetComponent<CharacterController>().velocity;
stream.Serialize(ref syncVelocity);
}
else
{
stream.Serialize(ref syncPosition);
stream.Serialize(ref syncRotation);
stream.Serialize(ref syncVelocity);
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
syncEndPosition = syncPosition + syncVelocity * syncDelay;
syncStartPosition = transform.position;
syncRotEnd = syncRotation;
syncRotStart = transform.rotation;
}
}
public void SyncedMovement()
{
syncTime += Time.deltaTime;
transform.position = Vector3.Lerp(syncStartPosition, syncEndPosition, syncTime / syncDelay);
transform.rotation = Quaternion.Lerp (syncRotStart, syncRotEnd, syncTime / syncDelay);
}
void OnApplicationFocus(bool focusStatus)
{
if (focusStatus)
{
if (screenLock)
{
Screen.lockCursor = true;
}
}
}
void Update () {
if (networkView.isMine)
{
UpdateMovement();
}
else
{
SyncedMovement();
}
}
private void UpdateMovement()
{
// Rotation
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivityX;
transform.Rotate(0, rotLeftRight, 0);
rotUpDown -= Input.GetAxis("Mouse Y") * mouseSensitivityY;
rotUpDown = Mathf.Clamp (rotUpDown, -headTiltMinimum, headTiltMaximum);
Camera.main.transform.localRotation = Quaternion.Euler (rotUpDown, 0, 0);
// Movement and Jumping
float desiredSpeed = walkSpeed;
if (Input.GetKey("w") || Input.GetKey("a") || Input.GetKey("s") || Input.GetKey("d"))
{
walk = true;
}
else
{
walk = false;
}
if (Input.GetButton("Sprint") && staminaCapacity > 0 && canUseStamina) // Sprint
{
sprint = true;
desiredSpeed = sprintSpeed;
staminaCapacity -= staminaEnergyUsage/2;
if (staminaCapacity <= 0)
{
staminaTime = Time.time;
}
}
else
{
sprint = false;
if (staminaCapacity < 100 && ((Time.time - staminaTime) >= staminaGainDelay))
{
if ((staminaCapacity += staminaEnergyGain) > 100)
{
staminaCapacity = 100;
}
else
{
staminaCapacity += staminaEnergyGain;
}
}
}
if (sprint)
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, staminaUseFOV, Time.deltaTime * 10);
}
else
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, defaultFieldOfView, Time.deltaTime * 10);
}
float forwardSpeed = Input.GetAxis("Vertical") * desiredSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * desiredSpeed;
verticalVelocity += Physics.gravity.y * Time.deltaTime;
if (Input.GetButtonDown("Jump") && cc.isGrounded)
{
verticalVelocity = jumpHeight;
}
Vector3 speed = new Vector3(sideSpeed, verticalVelocity, forwardSpeed);
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime);
}
}
EDIT: My mistakes. You wanted JavaScript not C#. There’s also on OnGUI in there that you can remove if you still plan on using this.
I appreciate the help. I will delete the OnGUI and see how the script goes.
StickyKeyStudios:
Sorry for the late reply. I followed the same tutorial in my game, and this is what I did. I can’t say 100% this works because I removed some of the code pertaining to synced animations since I haven’t fulled fixed that yet.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(CharacterController))]
[RequireComponent(typeof(NetworkView))]
public class FirstPersonController : MonoBehaviour {
public float defaultFieldOfView;
public float walkSpeed;
public float sprintSpeed;
public float mouseSensitivityX;
public float mouseSensitivityY;
public float headTiltMinimum;
public float headTiltMaximum;
public float jumpHeight;
public float staminaEnergyUsage;
public float staminaEnergyGain;
public float staminaCapacity;
public float staminaGainDelay;
public float staminaUseFOV;
public float maxHealth;
public float currentHealth;
private float rotUpDown = 0;
private float verticalVelocity = 0;
private bool canUseStamina = true;
private float staminaTime = 0;
private CharacterController cc;
private bool screenLock = true;
// Network Sync
private float lastSynchronizationTime = 0f;
private float syncDelay = 0f;
private float syncTime = 0f;
private Vector3 syncStartPosition = Vector3.zero;
private Vector3 syncEndPosition = Vector3.zero;
private Quaternion syncRotStart = Quaternion.identity;
private Quaternion syncRotEnd = Quaternion.identity;
void Start () {
Screen.lockCursor = true;
cc = GetComponent<CharacterController>();
}
void OnGUI()
{
GUI.Box (new Rect (32, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 4) - 8, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 2) - 16, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (3 * Screen.width / 4) - 24, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
}
public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
Vector3 syncPosition = Vector3.zero;
Quaternion syncRotation = Quaternion.identity;
Vector3 syncVelocity = Vector3.zero;
if (stream.isWriting)
{
syncPosition = transform.position;
stream.Serialize(ref syncPosition);
syncRotation = transform.rotation;
stream.Serialize(ref syncRotation);
syncVelocity = GetComponent<CharacterController>().velocity;
stream.Serialize(ref syncVelocity);
}
else
{
stream.Serialize(ref syncPosition);
stream.Serialize(ref syncRotation);
stream.Serialize(ref syncVelocity);
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
syncEndPosition = syncPosition + syncVelocity * syncDelay;
syncStartPosition = transform.position;
syncRotEnd = syncRotation;
syncRotStart = transform.rotation;
}
}
public void SyncedMovement()
{
syncTime += Time.deltaTime;
transform.position = Vector3.Lerp(syncStartPosition, syncEndPosition, syncTime / syncDelay);
transform.rotation = Quaternion.Lerp (syncRotStart, syncRotEnd, syncTime / syncDelay);
}
void OnApplicationFocus(bool focusStatus)
{
if (focusStatus)
{
if (screenLock)
{
Screen.lockCursor = true;
}
}
}
void Update () {
if (networkView.isMine)
{
UpdateMovement();
}
else
{
SyncedMovement();
}
}
private void UpdateMovement()
{
// Rotation
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivityX;
transform.Rotate(0, rotLeftRight, 0);
rotUpDown -= Input.GetAxis("Mouse Y") * mouseSensitivityY;
rotUpDown = Mathf.Clamp (rotUpDown, -headTiltMinimum, headTiltMaximum);
Camera.main.transform.localRotation = Quaternion.Euler (rotUpDown, 0, 0);
// Movement and Jumping
float desiredSpeed = walkSpeed;
if (Input.GetKey("w") || Input.GetKey("a") || Input.GetKey("s") || Input.GetKey("d"))
{
walk = true;
}
else
{
walk = false;
}
if (Input.GetButton("Sprint") && staminaCapacity > 0 && canUseStamina) // Sprint
{
sprint = true;
desiredSpeed = sprintSpeed;
staminaCapacity -= staminaEnergyUsage/2;
if (staminaCapacity <= 0)
{
staminaTime = Time.time;
}
}
else
{
sprint = false;
if (staminaCapacity < 100 && ((Time.time - staminaTime) >= staminaGainDelay))
{
if ((staminaCapacity += staminaEnergyGain) > 100)
{
staminaCapacity = 100;
}
else
{
staminaCapacity += staminaEnergyGain;
}
}
}
if (sprint)
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, staminaUseFOV, Time.deltaTime * 10);
}
else
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, defaultFieldOfView, Time.deltaTime * 10);
}
float forwardSpeed = Input.GetAxis("Vertical") * desiredSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * desiredSpeed;
verticalVelocity += Physics.gravity.y * Time.deltaTime;
if (Input.GetButtonDown("Jump") && cc.isGrounded)
{
verticalVelocity = jumpHeight;
}
Vector3 speed = new Vector3(sideSpeed, verticalVelocity, forwardSpeed);
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime);
}
}
EDIT: My mistakes. You wanted JavaScript not C#. There’s also on OnGUI in there that you can remove if you still plan on using this.
Assets/Scripts/FirstPersonController.cs(125,25): error CS0103: The name walk' does not exist in the current context Assets/Scripts/FirstPersonController.cs(129,25): error CS0103: The name walk’ does not exist in the current context
Assets/Scripts/FirstPersonController.cs(134,25): error CS0103: The name sprint' does not exist in the current context Assets/Scripts/FirstPersonController.cs(144,25): error CS0103: The name sprint’ does not exist in the current context
Assets/Scripts/FirstPersonController.cs(158,21): error CS0103: The name `sprint’ does not exist in the current context
420BlazeIt:
Assets/Scripts/FirstPersonController.cs(125,25): error CS0103: The name walk' does not exist in the current context Assets/Scripts/FirstPersonController.cs(129,25): error CS0103: The name walk’ does not exist in the current context
Assets/Scripts/FirstPersonController.cs(134,25): error CS0103: The name sprint' does not exist in the current context Assets/Scripts/FirstPersonController.cs(144,25): error CS0103: The name sprint’ does not exist in the current context
Assets/Scripts/FirstPersonController.cs(158,21): error CS0103: The name `sprint’ does not exist in the current context
Just remove those, they were part of the animation networking I was working on.
StickyKeyStudios:
Sorry for the late reply. I followed the same tutorial in my game, and this is what I did. I can’t say 100% this works because I removed some of the code pertaining to synced animations since I haven’t fulled fixed that yet.
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(CharacterController))]
[RequireComponent(typeof(NetworkView))]
public class FirstPersonController : MonoBehaviour {
public float defaultFieldOfView;
public float walkSpeed;
public float sprintSpeed;
public float mouseSensitivityX;
public float mouseSensitivityY;
public float headTiltMinimum;
public float headTiltMaximum;
public float jumpHeight;
public float staminaEnergyUsage;
public float staminaEnergyGain;
public float staminaCapacity;
public float staminaGainDelay;
public float staminaUseFOV;
public float maxHealth;
public float currentHealth;
private float rotUpDown = 0;
private float verticalVelocity = 0;
private bool canUseStamina = true;
private float staminaTime = 0;
private CharacterController cc;
private bool screenLock = true;
// Network Sync
private float lastSynchronizationTime = 0f;
private float syncDelay = 0f;
private float syncTime = 0f;
private Vector3 syncStartPosition = Vector3.zero;
private Vector3 syncEndPosition = Vector3.zero;
private Quaternion syncRotStart = Quaternion.identity;
private Quaternion syncRotEnd = Quaternion.identity;
void Start () {
Screen.lockCursor = true;
cc = GetComponent<CharacterController>();
}
void OnGUI()
{
GUI.Box (new Rect (32, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 4) - 8, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (Screen.width / 2) - 16, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
GUI.Box (new Rect (32 + (3 * Screen.width / 4) - 24, (Screen.height - 48), (Screen.width / 4) - 40, 32), "");
}
public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
{
Vector3 syncPosition = Vector3.zero;
Quaternion syncRotation = Quaternion.identity;
Vector3 syncVelocity = Vector3.zero;
if (stream.isWriting)
{
syncPosition = transform.position;
stream.Serialize(ref syncPosition);
syncRotation = transform.rotation;
stream.Serialize(ref syncRotation);
syncVelocity = GetComponent<CharacterController>().velocity;
stream.Serialize(ref syncVelocity);
}
else
{
stream.Serialize(ref syncPosition);
stream.Serialize(ref syncRotation);
stream.Serialize(ref syncVelocity);
syncTime = 0f;
syncDelay = Time.time - lastSynchronizationTime;
lastSynchronizationTime = Time.time;
syncEndPosition = syncPosition + syncVelocity * syncDelay;
syncStartPosition = transform.position;
syncRotEnd = syncRotation;
syncRotStart = transform.rotation;
}
}
public void SyncedMovement()
{
syncTime += Time.deltaTime;
transform.position = Vector3.Lerp(syncStartPosition, syncEndPosition, syncTime / syncDelay);
transform.rotation = Quaternion.Lerp (syncRotStart, syncRotEnd, syncTime / syncDelay);
}
void OnApplicationFocus(bool focusStatus)
{
if (focusStatus)
{
if (screenLock)
{
Screen.lockCursor = true;
}
}
}
void Update () {
if (networkView.isMine)
{
UpdateMovement();
}
else
{
SyncedMovement();
}
}
private void UpdateMovement()
{
// Rotation
float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivityX;
transform.Rotate(0, rotLeftRight, 0);
rotUpDown -= Input.GetAxis("Mouse Y") * mouseSensitivityY;
rotUpDown = Mathf.Clamp (rotUpDown, -headTiltMinimum, headTiltMaximum);
Camera.main.transform.localRotation = Quaternion.Euler (rotUpDown, 0, 0);
// Movement and Jumping
float desiredSpeed = walkSpeed;
if (Input.GetKey("w") || Input.GetKey("a") || Input.GetKey("s") || Input.GetKey("d"))
{
walk = true;
}
else
{
walk = false;
}
if (Input.GetButton("Sprint") && staminaCapacity > 0 && canUseStamina) // Sprint
{
sprint = true;
desiredSpeed = sprintSpeed;
staminaCapacity -= staminaEnergyUsage/2;
if (staminaCapacity <= 0)
{
staminaTime = Time.time;
}
}
else
{
sprint = false;
if (staminaCapacity < 100 && ((Time.time - staminaTime) >= staminaGainDelay))
{
if ((staminaCapacity += staminaEnergyGain) > 100)
{
staminaCapacity = 100;
}
else
{
staminaCapacity += staminaEnergyGain;
}
}
}
if (sprint)
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, staminaUseFOV, Time.deltaTime * 10);
}
else
{
Camera.main.fieldOfView = Mathf.Lerp(Camera.main.fieldOfView, defaultFieldOfView, Time.deltaTime * 10);
}
float forwardSpeed = Input.GetAxis("Vertical") * desiredSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * desiredSpeed;
verticalVelocity += Physics.gravity.y * Time.deltaTime;
if (Input.GetButtonDown("Jump") && cc.isGrounded)
{
verticalVelocity = jumpHeight;
}
Vector3 speed = new Vector3(sideSpeed, verticalVelocity, forwardSpeed);
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime);
}
}
EDIT: My mistakes. You wanted JavaScript not C#. There’s also on OnGUI in there that you can remove if you still plan on using this.
Could you please cut out the unrelated parts of this script I don’t really know anything about C# so could you please just send me the Prediction System part of the script please. Also what is the file name supposed to be? And do I attach this script to the Player Prefab?