Hi, im working on puzzle game in multiplayer and works all well(about all =) ), anyway when i try my game on my computer, i launch editor and pc, mac & linux standlone .exe, all seems to be fine except when i press ‘w’ or 'a ’ or ‘s’ or ‘d’ movement key in exe for move player, then black screen in game appear immediately on editor and it show this error message:
transform.position assign attempt for ‘Player(Clone)’ is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Transform:set_position(Vector3)
MovementUpdate:UpdateMovement(Vector3, Quaternion) (at Assets/scripts/Network Scripts/MovementUpdate.cs:72)
not change nothing if i make vice-versa(client/server - server/client), ever if i press any movement button key, black screen appear and error message is printing(black screen appear only in exe, editor works perfectly in all two case)
I try another solution, i build exactly same project in web player, and this time works both(client/server - server/client), without black screen and errors.
There is my pc info:
- Windows 7 Home Premium Service Pack 1
- HP Pavilion dv6 Notebook PC
- Intel(R) Core™ i7-2630QM CPU @ 2.00GHz 2.00 GHz
- 4,00 GB RAM
- 64 bit
- Kaspersky PURE
And this is the script that give me error:(only in exe, of course)
using UnityEngine;
using System.Collections;
/// <summary>
/// This script is attached to the player and it
/// ensure that every players position, rotation, and scale,
/// are kept up to date across the network
/// </summary>
public class MovementUpdate : MonoBehaviour {
//Variables Start_________________________
private Vector3 _lastPosition;
private Quaternion _lastRotation;
private Transform _myTransform;
//Variables End_________________________
// Use this for initialization
void Start () {
if (networkView.isMine)
{
_myTransform = transform;
//ensure that everyone sees the player at the correct location
//the moment they spawn
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered,
_myTransform.position, _myTransform.rotation);
}
else
{
enabled = false;
}
}
// Update is called once per frame
void Update ()
{
//if the player has moved at all then fire off an RPC to update the players
//position and rotation across the network
if (Vector3.Distance(_myTransform.position, _lastPosition) >= 0.1f)
{
//Capture the player's position before the RPC is fired off and use this
//to determine if the player has moved in the if statement above
_lastPosition = _myTransform.position;
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered,
_myTransform.position, _myTransform.rotation);
}
if (Quaternion.Angle(_myTransform.rotation, _lastRotation) >= 1)
{
//Capture the player's rotation before the RPC is fired off and use this
//to determine if the player has turned in the if statement above
_lastRotation = _myTransform.rotation;
networkView.RPC("UpdateMovement", RPCMode.OthersBuffered,
_myTransform.position, _myTransform.rotation);
}
}
[RPC]
void UpdateMovement(Vector3 newPosition, Quaternion newRotation)
{
//print(newPosition.ToString());
//print(newRotation.ToString());
transform.position = new Vector3(newPosition.x, newPosition.y, newPosition.z);
transform.rotation = new Quaternion(newRotation.x, newRotation.y, newRotation.z, newRotation.w);
}
}
Thanks for help, i dont know what i can i do. S: