Whoever answers this properly will recieve $1.00

[The offer is now 2$]

The first person to solve my problem (In my opinion, not yours) will receive one dollar. You’ll just have to trust me on that. I can’t give you the dollar if you do not have paypal.

I have tried and tried for days to get a proper answer here, so now I’m gonna have to start paying apparently. I want someone to make me a working example (A Unity Project) of using OnSerializeNetworkView. I have been trying for days to get this function to do something on the receiving end, and cannot.

Just make me a working example, and post a link where I can download it. If it actually solves my specific problem I will give you the dollar. I will PM you asking for your paypal.

42

One Dollar, oh my! Imagine all the things I could buy with that!

So you managed to make an unappealing offer, and also deny to everyone else the right to feel good about answering something for free because they feel like it. Well done.

If your going to pay somebody at least make it worthwhile. $20 bucks isn’t too much to ask for right? (Even $20 seems small by gaming industry standards)

1$ is pretty good for something you would normally do for free.

Now I’m offering 2$. Acid makes the community look bad because of his rudeness. Hippo is making the community look bad because of his waste of time replies.

You people are making Unity look bad. Good job. Nobody likes d-bag communities.

20$ is extreme for this. I’m not gonna pay 20$ on a forum where everyone else is getting help for free.

It’s a simple thing to ask, a working demo of OnSerializeNetworkView, it’s like <10 lines of code and a few mouse clicks to put together for anyone who knows how.

I’ve been trying for days to get this to work. It must be some tiny thing holding it back.

Well there is a bit more too it, but you should be able to find a good resource somewhere.
Somewhere like here? Unity - Scripting API: Network.OnSerializeNetworkView(BitStream,NetworkMessageInfo)

I’ve read that multiple times, along with about 100 other pages of relevant material (no exaggeration).

Well how about you show us the code/setup you got going now? That will at least know where your trying to get at.

Ok I’ll make it even easier, I’m going to post a download link for my project files. It is 85 mb. There is almost nothing in it so you should find navigation easy.

Just look at the script “TestOnSerializeNetworkView”, that is the only script that has OnSerializeNetworkView() being used. Just tell me why it’s not working, and if that fixes it for me I’ll give you the 2$

“TestOnSerializeNetworkView” is attached to the Player prefab.

http://www.mediafire.com/?wkghoszj8t38bl3 ← Project files

I think this thread might of gone better if you didn’t offer the dollar, and then up it to an awesomely amazing 2!

I think the reason is that while a lot of people help here for free, offering that sort of amount could be viewed as insulting.

Oh, oh!! I know. i know!
You didn’t add a NetworkView component to your gameObject!!! Do I win?

Sorry, just messing with ya.

Help ME out people, please… Am I correct in saying that this function will only be called if a NetworkView component is attached to an object AND the app is connected to a running server (or is the server as the case may be)? Or is the NetworkView optional?

Going for the dollar now:

var currentHealth : int;

function OnSerializeNetworkView(stream : BitStream, 
    info : NetworkMessageInfo) {
Debug.Log("If you are seeing this, you are not asleep");
    var health : int = 0;
    if (stream.isWriting) {
        health = currentHealth;
        stream.Serialize(health);
    } else {
        stream.Serialize(health);
        currentHealth = health;
    }    
}

…this should determine wither the problem is with the execution or the content…

keep your dollar

	void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
	{
		if (stream.isWriting)
		{
			Vector3 pos = transform.position;	
			Quaternion yRot = transform.rotation;
			stream.Serialize(ref pos);
			stream.Serialize(ref yRot);
		}
		else
		{
			Vector3 posReceive = Vector3.zero;
			Quaternion yRotReceive = transform.rotation;
			stream.Serialize(ref posReceive);
			stream.Serialize(ref yRotReceive);
			transform.position = posReceive;		
			transform.rotation = yRotReceive;
			transform.position = Vector3.Lerp(transform.position, posReceive, 0.9F);
		}
	}

Already tried that. The debug message shows. And if I put it under if(stream.isWriting) it still shows, indicating that it is actually sending the message. But if I put one under “else” it doesn’t show the debug message, indicating nothing is receiving it. Even tho I have a server and a client running and I can clearly see both characters running around on both the client and the server.

Sorry but that also doesn’t pertain to my problem. Someone should really just download my project files which I linked to and take a look at them. It’s a small project, navigation should be easy.

Just run a client and a server and test it out. There is only one place where OnSerializeNetworkView() is used and that is in the script TestOnSerializeNetworkView, which is attached to the Player prefab, which has a NetworkView attached.

please ask this guy, Leepo, he may help you if you willing to pay more… no free lunch :stuck_out_tongue:

http://forum.unity3d.com/threads/75385-Ultimate-Unity-Networking-project-Add-multiplayer-to-your-game-today!

…In fact, I learnt how to use the network function from him :sunglasses:

You mean, like this?

	void OnSerializeNetworkView(BitStream _bitStream, NetworkMessageInfo _messageInfo)
	{
		if(_bitStream.isWriting) //Send messages
		{
			Vector3 _SendPos = transform.position;
			Quaternion _SendRot = transform.rotation;
			Vector3 _SendVel = rigidbody.velocity;
			Vector3 _SendAngleVel = rigidbody.angularVelocity;
			
			_bitStream.Serialize(ref _SendPos);
			_bitStream.Serialize(ref _SendRot);
			_bitStream.Serialize(ref _SendVel);
			_bitStream.Serialize(ref _SendAngleVel);
			
		}
		else //Recieving.
		{
			Vector3 _RecievePos = Vector3.zero;
			Quaternion _RecieveRot = Quaternion.Euler(0,0,0);
			Vector3 _RecieveVel = Vector3.zero;
			Vector3 _RecieveAngleVel = Vector3.zero;
			
			_bitStream.Serialize(ref _RecievePos);
			_bitStream.Serialize(ref _RecieveRot);
			_bitStream.Serialize(ref _RecieveVel);
			_bitStream.Serialize(ref _RecieveAngleVel);
			
			transform.position = _RecievePos;
			transform.rotation = _RecieveRot;
			rigidbody.velocity = _RecieveVel;
			rigidbody.angularVelocity = _RecieveAngleVel;
		
		}
	}

On network view, set observe to the sccript in which this event is.

Sends position, rotation, rigidbody velocity and angular velocity. Remove and add variables to transfer in the same way as I have. Sending velocity is a cheap way of making the other players’ movement look smoother.

Youtube videos that I learned multipalyer from.

followed by

And readong about NetworkViews in the Script Reference and knowing how they work is really useful.

In case anyone is wondering… (AKA to stir the pot).

If I give free advice that is all it is, free advice. Take it or leave it.

If you pay me a dollar suddenly it is a contract… and a whole bunch of headaches ensue.

So, in a weird twist of legalese $1<Free.

Just learn to code mate, your $2 is really insulting.