Hi Guys
i just finished the tutorial of multiplayer using smartfox but i’ve a little problem that i i couldn’t fix
the character instantiate are too small.
how can i fix that?
i tryed
UnityEngine.Object remotePlayer = Instantiate(remotePlayerPrefab, new Vector3(-10000, -10000, -10000), new Quaternion(0,0,0,1));
remotePlayer.transform.localScale.x+=10;
but it didnt compile
please help me
And why didn’t it compile?
thnks for the quiq response
private void SpawnRemotePlayer(User user) {
// Just spawn remote player at a very remote point
UnityEngine.Object remotePlayer = Instantiate(remotePlayerPrefab, new Vector3(-10000, -10000, -10000), new Quaternion(0,0,0,1));
remotePlayer.transform.localScale.x=10;
//Give remote player a name like “remote_” to easily find him then
remotePlayer.name = “remote_”+user.GetId();
//Start receiving trasnform synchronization messages
(remotePlayer as Component).SendMessage(“StartReceiving”);
// Force this player to send us transform
ForceRemotePlayerToSendTransform(user);
}
it says Assets/Scripts/network/PlayerSpawnController.cs(42,46): error CS1061: Type UnityEngine.Object' does not contain a definition for
transform’ and no extension method transform' of type
UnityEngine.Object’ could be found (are you missing a using directive or an assembly reference?)
You are instantiating your prefab as a UnityEngine.Object. This is NOT a GameObject, thus it does not have position and rotational properties. What you need to do is change this line:
UnityEngine.Object remotePlayer = Instantiate(remotePlayerPrefab, new Vector3(-10000, -10000, -10000), new Quaternion(0,0,0,1));
to this:
GameObject remotePlayer = (GameObject) Instantiate(remotePlayerPrefab, new Vector3(-10000, -10000, -10000), new Quaternion(0,0,0,1));