c# - Unity RPC not being called -


i have been bashing head against rpc call few hours now, , despite extensive googling cannot figure out going wrong.

at moment, doing testing within unity editor, (player set run in background if matters).

for reason, rpc call isn't going through.

there lot of stuff going on in code, important bit (i think) is:

public void generatedungeon() {     debug.log ("generating dungeon");     tiles = dungeon.setdungeondata();      //begin looking through every single tile     for(int = 0; < tiles.length; i++)     {            //if our tile useful, aka not void area in dungeon         if(tiles[i] != 0){              //bogus location             int x = 0;             int z = 0;              //real world location             convert.convertindextoxy(i,ref x,ref z);              //wouldn't need if understood math, since don't being careful             int lefttile = tiles[convert.convertxytoindex(x-1,z)];             int righttile = tiles[convert.convertxytoindex(x+1,z)];             int toptile = tiles[convert.convertxytoindex(x,z-1)];             int bottomtile = tiles[convert.convertxytoindex(x,z+1)];              //create base layer compairing dungeon             createdebugdungeon(x,z);              //determine trying spawn, , spawn             if(tiles[i] == (short)enums.tiletype.corner)                 checkcorners(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);              if(tiles[i] == (short)enums.tiletype.onewall)                 checkonewalls(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);              if(tiles[i] == (short)enums.tiletype.floorandroof)                 createtile((int)enums.tiletype.floorandroof, x,z,0,dungeonwidth,dungeonheight);              if(tiles[i] == (short)enums.tiletype.corridor)                 checkcorridors(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);             }//end if tiles != 0     }//end      debug.log ("done pushing tiles");     //networkview.rpc("spawncharacter",rpcmode.allbuffered, team1spawn);     networkview.rpc ("spawncharacter",rpcmode.all);     //networkview.rpc ("merp",rpcmode.all);     //networkview.rpc ("pushtiles",rpcmode.all);     //debug.log ("merr?");  }//end generate dungeon  [rpc] void spawncharacter() {     debug.log ("spawning character @ : " );     //instantiate(character,position, quaternion.identity); } 

at moment, should called server side.

here full code script:

using unityengine; using system.collections; /// <summary> /// bsp spawning script responsible creating dungeon scratch finished. /// </summary> public class bspspawningscript : monobehaviour{  public int dungeonwidth = 80; public int dungeonheight = 80; public int numsplits = 4; public gameobject character; public float charyoffset;  short[] tiles;  bspdungeon dungeon; coconvert convert; bool team1  = false; bool team2 = false; gameobject lasttile; vector3 team1spawn;  void start() {     if(network.isclient)     {         gameobject.destroy(this.gameobject);         debug.log ("destroying");        }      convert = new coconvert(dungeonwidth);     dungeon = new bspdungeon(dungeonwidth, dungeonheight);     dungeon.treedata.splitnodes(numsplits);     dungeon.generaterooms ();     dungeon.generatecorridors();     generatedungeon(); }  public void reset() {     dungeon.reset();     dungeon.treedata.splitnodes(numsplits);     dungeon.generaterooms ();     dungeon.generatecorridors();     generatedungeon(); }  public void generatedungeon() {     debug.log ("generating dungeon");     tiles = dungeon.setdungeondata();      //begin looking through every single tile     for(int = 0; < tiles.length; i++)     {            //if our tile useful, aka not void area in dungeon         if(tiles[i] != 0){          //bogus location         int x = 0;         int z = 0;          //real world location         convert.convertindextoxy(i,ref x,ref z);          //wouldn't need if understood math, since don't being careful         int lefttile = tiles[convert.convertxytoindex(x-1,z)];         int righttile = tiles[convert.convertxytoindex(x+1,z)];         int toptile = tiles[convert.convertxytoindex(x,z-1)];         int bottomtile = tiles[convert.convertxytoindex(x,z+1)];          //create base layer compairing dungeon         createdebugdungeon(x,z);          //determine trying spawn, , spawn         if(tiles[i] == (short)enums.tiletype.corner)             checkcorners(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);          if(tiles[i] == (short)enums.tiletype.onewall)             checkonewalls(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);          if(tiles[i] == (short)enums.tiletype.floorandroof)             createtile((int)enums.tiletype.floorandroof, x,z,0,dungeonwidth,dungeonheight);          if(tiles[i] == (short)enums.tiletype.corridor)             checkcorridors(lefttile, righttile, toptile, bottomtile, x, z, dungeonwidth, dungeonheight);             }//end if tiles != 0     }//end      debug.log ("done pushing tiles");     //networkview.rpc("spawncharacter",rpcmode.allbuffered, team1spawn);     networkview.rpc ("spawncharacter",rpcmode.all);     //networkview.rpc ("merp",rpcmode.all);     //networkview.rpc ("pushtiles",rpcmode.all);     //debug.log ("merr?");  }//end generate dungeon  [rpc] void spawncharacter() {     debug.log ("spawning character @ : " );     //instantiate(character,position, quaternion.identity); }  /// <summary> /// create tile responsible instantiating tiles.   /// </summary> /// <param name="tiletype">what tile type spawn.</param> /// <param name="x">the x coordinate spawn tile at.</param> /// <param name="z">the z coordinate spawn tile at.</param> /// <param name="rotation">what rotation spawn tile at.</param> /// <param name="dungeonwidth">dungeon width.</param> /// <param name="dungeonheight">dungeon height.</param> public void createtile(int tiletype, int x, int z, float rotation, int dungeonwidth, int dungeonheight) {     //so displays right-side in center of scene     x -= dungeonwidth/2;     z -= dungeonheight/2;      //offsetting tile size     x *= 8;     z *= -8;      //set temporary object     gameobject tempobject;      //get it's position     vector3 temppos = new vector3(x,0,z);      bool sendspawn = false;      switch(tiletype)     {         case -1:             debug.log ("none found " + temppos);             tempobject = (gameobject)gameobject.instantiate(resources.load("error"));             break;         case (int)enums.tiletype.corner:             tempobject = (gameobject)gameobject.instantiate(resources.load("corner"));             break;         case (int)enums.tiletype.onewall:             tempobject = (gameobject)gameobject.instantiate(resources.load("onewall"));             break;         case (int)enums.tiletype.doorway:             tempobject = (gameobject)gameobject.instantiate(resources.load("doorway"));             break;         case (int)enums.tiletype.floorandroof:             tempobject =(gameobject)gameobject.instantiate(resources.load("floorandroof"));         if(team1 == false)             {                 //character.transform.position = new vector3(x, charyoffset,z);                 //gameobject.find"                       team1spawn = new vector3(x, charyoffset, z);                         team1 = true;                 sendspawn = true;                 debug.log ("setting spawn");             }             break;     case (int)enums.tiletype.corridor:         tempobject =(gameobject)gameobject.instantiate(resources.load("corridor"));         break;     default:         tempobject = (gameobject)gameobject.instantiate(resources.load ("error"));         debug.log ("default " + temppos);         break;     }      tempobject.transform.rotate (new vector3(0f, rotation, 0f));     tempobject.transform.position = temppos;       //testing     networkview.rpc ("pushtile", rpcmode.allbuffered, tempobject, temppos, rotation);      //gameobject.destroy (tempobject); }  [rpc] void pushtile(gameobject tileobject, vector3 tileposition, float rotation) {     debug.log ("rawr");     gameobject objectcopy = tileobject;     quaternion newrotation = quaternion.euler(0f, rotation, 0f);     network.instantiate(objectcopy, tileposition, newrotation, 0); }  /// <summary> /// determins direction tile should face, corner. /// </summary> /// <param name="lefttile">the tile left of target tile.</param> /// <param name="righttile">the tile right of target tile.</param> /// <param name="toptile">the tile ontop of target tile</param> /// <param name="bottomtile">the tile below target tile</param> /// <param name="x">the x coordinate of target tile.</param> /// <param name="z">the z coordinate of target tile.</param> /// <param name="dungeonwidth">dungeon width.</param> /// <param name="dungeonheight">dungeon height.</param> public void checkcorners (int lefttile, int righttile, int toptile, int bottomtile, int x, int z, int dungeonwidth, int dungeonheight) {     //left , top empty = nw     //left , bottom empty = sw     //right , top empty = ne     //right , bottom empty = nw      if(lefttile == (int)enums.tiletype.empty)     {         if(toptile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.corner,x,z,(float)enums.cornerdirections.northwest, dungeonwidth, dungeonheight);          else if(bottomtile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.corner,x,z,(float)enums.cornerdirections.southwest, dungeonwidth, dungeonheight);          else             createtile(-1,x,z,0, dungeonwidth, dungeonheight);     }     else if(righttile == (int)enums.tiletype.empty)     {         if(toptile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.corner,x,z,(float)enums.cornerdirections.northeast, dungeonwidth, dungeonheight);          else if(bottomtile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.corner,x,z,(float)enums.cornerdirections.southeast, dungeonwidth, dungeonheight);          else             createtile(-1,x,z,0, dungeonwidth, dungeonheight);                   } else     createtile(-1,x,z,0, dungeonwidth, dungeonheight); }      /// <summary>     /// determins direction tile should face, single wall.     /// </summary>     /// <param name="lefttile">the tile left of target tile.</param>     /// <param name="righttile">the tile right of target tile.</param>     /// <param name="toptile">the tile ontop of target tile</param>     /// <param name="bottomtile">the tile below target tile</param>     /// <param name="x">the x coordinate of target tile.</param>     /// <param name="z">the z coordinate of target tile.</param>     /// <param name="dungeonwidth">dungeon width.</param>     /// <param name="dungeonheight">dungeon height.</param>     public void checkonewalls(int lefttile, int righttile, int toptile, int bottomtile, int x, int z, int dungeonwidth, int dungeonheight)     {                if(bottomtile == (int)enums.tiletype.floorandroof && toptile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.onewall, x,z,(float)enums.onewalldirections.north, dungeonwidth, dungeonheight);          else if(lefttile == (int)enums.tiletype.floorandroof && righttile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.onewall, x,z,(float)enums.onewalldirections.east, dungeonwidth, dungeonheight);          else if(righttile == (int)enums.tiletype.floorandroof && lefttile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.onewall, x,z,(float)enums.onewalldirections.west, dungeonwidth, dungeonheight);          else if(toptile == (int)enums.tiletype.floorandroof && bottomtile == (int)enums.tiletype.empty)             createtile((int)enums.tiletype.onewall, x,z,(float)enums.onewalldirections.south, dungeonwidth, dungeonheight);          else if(bottomtile == (int)enums.tiletype.corridor)             createtile((int)enums.tiletype.doorway, x,z,(float)enums.doorwaydirections.south, dungeonwidth, dungeonheight);          else if(toptile == (int)enums.tiletype.corridor)             createtile((int)enums.tiletype.doorway, x,z,(float)enums.doorwaydirections.north, dungeonwidth, dungeonheight);          else if(lefttile == (int)enums.tiletype.corridor)             createtile((int)enums.tiletype.doorway, x,z,(float)enums.doorwaydirections.west, dungeonwidth, dungeonheight);          else if(righttile == (int)enums.tiletype.corridor)             createtile((int)enums.tiletype.doorway, x,z,(float)enums.doorwaydirections.east, dungeonwidth, dungeonheight);          else             createtile(-1, x,z,0, dungeonwidth, dungeonheight); }  /// <summary> /// determins direction tile should face, corridor. /// </summary> /// <param name="lefttile">the tile left of target tile.</param> /// <param name="righttile">the tile right of target tile.</param> /// <param name="toptile">the tile ontop of target tile</param> /// <param name="bottomtile">the tile below target tile</param>     /// <param name="x">the x coordinate of target tile.</param> /// <param name="z">the z coordinate of target tile.</param> /// <param name="dungeonwidth">dungeon width.</param> /// <param name="dungeonheight">dungeon height.</param> public void checkcorridors(int lefttile, int righttile, int toptile, int bottomtile, int x, int z, int dungeonwidth, int dungeonheight) {     //we n/s corridor if our bottom tile a...     //doorway, corridor, or single wall (because checked before walls have become doorways)     if(bottomtile == (int)enums.tiletype.doorway || bottomtile == (int)enums.tiletype.corridor || bottomtile == (int)enums.tiletype.onewall)         createtile((int)enums.tiletype.corridor, x,z,(float)enums.corridordirections.northsouth, dungeonwidth, dungeonheight);      //we w/e corridor if our bottom tile a...     //doorway, corridor, or single wall (because checked before walls have become doorways)     else if(lefttile == (int)enums.tiletype.doorway || lefttile == (int)enums.tiletype.corridor || lefttile == (int)enums.tiletype.onewall)         createtile((int)enums.tiletype.corridor, x,z,(float)enums.corridordirections.westeast, dungeonwidth, dungeonheight);      else         createtile(-1, x,z,0, dungeonwidth, dungeonheight); }  /// <summary> /// create debug dungeon responible creating flat dungeon underneathe (-2 y) real dungeon. /// testing , should not included in final product. /// </summary> /// <param name="x">the x coordinate of tile create.</param> /// <param name="z">the z coordinate of tile create.</param> public void createdebugdungeon(int x, int z) {     //so displays right-side in center of scene     x -= dungeonwidth/2;     z -= dungeonheight/2;      //offsetting tile size     x *= 8;     z *= -8;      gameobject tempobjectdebug = (gameobject)gameobject.instantiate(resources.load("testsubject"));     tempobjectdebug.transform.position = new vector3(x, -2, z); } 

}

after said , done, console print: generating dungeon setting dungeon data setting spawn done pushing tiles

the character reference set correctly, tiles being instantiated correctly, seems working intended, exception of rpc call being ignored? there no errors, no warnings.

i appreciate can give, tiffany


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -