Search Unity

Network.Instantiate: Asset couldn't be found...

Discussion in 'Multiplayer' started by vampir26, Jun 3, 2010.

  1. vampir26

    vampir26

    Joined:
    Mar 29, 2010
    Posts:
    108
    Hi
    Sorry, my english is not very good. But I think, you understand me.
    I want to spawn a player.
    I have a client project and a server project.

    Client:
    Code (csharp):
    1.  
    2. function Start(){
    3.    Network.Connect("127.0.0.1", 25000, "pass");
    4. }
    Server:
    Code (csharp):
    1. function Start(){
    2.    Network.InitializeSecurity();
    3.    Network.incomingPassword = "pass";
    4.    Network.InitializeServer(4, 25000);
    5. }
    6.  
    7. var player1 : Transform;
    8. function OnPlayerConnected(player: NetworkPlayer){
    9.    Network.Instantiate(player1, new Vector3(1, 0, 1), Quaternion(0,0,0,0), 0);
    10. }
    player1 is a prefab (yes, with a networkView component). This prefab is in both projects, same name and in the same folder.
    Client errors:
    - Network.Instantiate on the receiving client failed because the asset couldn't be found in the project
    - View ID AllocatedID: 1 not found during lookup. Strange behaviour may occur
    - Received state update for view id' AllocatedID: 1' but the NetworkView doesn't exist

    No errors on server. The player spawns and I can move it.

    Can somebody help me please?
    Why can't unity3d find the prefab?

    Thx
     
  2. d.toliaferro

    d.toliaferro

    Joined:
    Jan 24, 2011
    Posts:
    95
    I know this thread is old as dirt, but I found a solution here.

    The prefab must be in both projects, and it must be the same exact prefab. IE: If you created the prefab on the server, then it must be transferred to the client machine first. What I do is I make a unitypackage of the prefab and Dropbox it to the other machine. It works like a charm.
     
    Last edited: May 13, 2011
  3. zilo

    zilo

    Joined:
    May 1, 2011
    Posts:
    3
    try export package
    export that object and import it to different project
     
  4. pertsa

    pertsa

    Joined:
    Jul 3, 2013
    Posts:
    15
    That did it, thank you very many!