Search Unity

Strange crashes upon instantiate?

Discussion in 'Multiplayer' started by Flynn, Oct 30, 2009.

  1. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Ever since I started this game, players have been experiencing crashes when they fire their weapons (hence instantiating a projectile). I haven't the foggiest why instantiating a player doesn't crash a person's browser, but that firing a projectile does!

    Code (csharp):
    1. //Spawn instantiation
    2.  
    3.  
    4. var clone = Network.Instantiate(playerPrefab, pos, transform.rotation, 0);
    5.  
    6.  
    7. //Ship instantiation
    8.  
    9.  
    10. var clone : GameObject;
    11. if (Network.peerType == NetworkPeerType.Disconnected)
    12. {
    13.      clone = Instantiate(projectiles[0],ps[pp].position,transform.rotation).gameObject;
    14. }
    15. else
    16. {
    17.           clone = Network.Instantiate(projectiles[0],ps[pp].position,transform.rotation,0).gameObject;
    18. }
    19.  
    20.  
    21. //In both cases, clone is used to set variables after the instantiation.
    22.  

    Any help?