I know Stream.serialize does not sync string value...
actually, in my multiplayer, I want to get some variable from other's player by pointing raycast to instantiated player(remote) , the problem is variable won't syncronized between local player and instantiated remote player on other computer , and raycast getComponent returns null...
so if it impossible, please help me to figure this by RPC,in this situation (raycast selecting)?
any help is appreciated.. :D
**edit:**
OK, Sorry.. my achievement is getting "status" directly from raycast
1. As selector, I put this script on Camera:> function Update(){> var ray : Ray = camera.main.ScreenPointToRay(Input.mousePosition);> var hit : RaycastHit;> if (Physics.Raycast (ray.origin, ray.direction, hit, 100)) {> ////////////reading status other player///////////////////> if (hit.collider.tag=="player"){> Debug.Log(hit.collider.gameObject.GetComponent("PlayerData").Status);> }> }> }
2.and in player prefab i added PlayerData.js and attach Network view observed to this :> var statusUpdated:boolean;> var Status:String; function>> OnSerializeNetworkView(stream :BitStream, info : NetworkMessageInfo){> if (statusUpdated==false){> statusUpdated=true;> stream.Serialize(this.status); > }> }
and the problem still same,serializing string value on the last line.
↧