Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.Networking;
- public class SyncCube : NetworkBehaviour {
- [SyncVar]
- private Vector3 syncPos;
- // Use this for initialization
- void Start () {
- syncPos = transform.position;
- }
- // Update is called once per frame
- void Update ()
- {
- if (isClient)
- {
- transform.position = Vector3.Lerp (transform.position, syncPos, 5 * Time.deltaTime);
- }
- if (isServer)
- {
- transform.Translate (Vector3.forward * Time.deltaTime);
- syncPos = transform.position;
- }
- }
- }
Add Comment
Please, Sign In to add comment