networking - how to find out which player is the caller of a function? RPC

I have a situation:

there 's a small sphere moved by arrow keys. if I press space it leaves a cube in it's place.

What I'm looking for here is - if there are multiple players logged into that "game", I want the player to see his cubes placed "white" and all his opponents' - as red. how to make that function "CreateDestroyBox" recognize when it is "me" who is placing a cube?

    function Update () {
    if(Input.GetKeyDown(KeyCode.RightArrow)) transform.position.x += 1;
    if(Input.GetKeyDown(KeyCode.LeftArrow)) transform.position.x -= 1;
    if(Input.GetKeyDown(KeyCode.UpArrow)) transform.position.y += 1;
    if(Input.GetKeyDown(KeyCode.DownArrow)) transform.position.y -= 1;

    if(Input.GetKeyDown(KeyCode.Space))
        networkView.RPC("CreateDestroyBox", RPCMode.AllBuffered, transform.position, 1 );

}
var Parent:Transform;

@RPC
function CreateDestroyBox(loc:Vector3, mine:int){
    var thereWasSomething = false;
    var location = loc;
    location.z +=.5;
    for(var child:Transform in Parent)
        if(child.position == location)
        {
            Destroy(child.gameObject);
            thereWasSomething = true;
        }
    if(!thereWasSomething)
    {
        var cube:GameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
        cube.transform.position = location;
        cube.transform.parent = Parent;
        var cubeColor;
        if(mine == 1){
            cubeColor = Color.white;
        }
        else cubeColor = Color.red; 
        cube.renderer.material.color = cubeColor;
    }
}

Well, there is a couple of ways you could do this. If you place,

info : NetworkMessageInfo

into your RPC as a recieved parameter that info variable will tell you a bunch of information about who sent the RPC.

For example if you changed your function to this

@RPC
function CreateDestroyBox(loc:Vector3, mine:int, info : NetworkMessageInfo){}

You could then compare who sent the RPC with the Network.player that you are currently running the script in and do it that way. Another way you could do this is by changing your RPC to look like this.

@RPC
function CreateDestroyBox(loc:Vector3, mine:int, owningPlayer : NetworkPlayer){}

and when you send the RPC you would add Network.player to the end like this.

networkView.RPC("CreateDestroyBox", RPCMode.AllBuffered, Vector3(), 1, Network.player);

Then on recieving the rpc you can compare the sent in NetworkPlayer to the Network.player that is running the script and determine the owner and therefore the render color that way as well.