Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When connecting to a server, the registered scene prefabs remain disabled (plus spawn-in questions) #11

Open
SoftwareGuy opened this issue Nov 1, 2018 · 1 comment
Labels

Comments

@SoftwareGuy
Copy link

This is a two-part issue ticket. Let's start with the puzzler:
In my test scene, I have 2 prefabs that are called "Floor" and "Game". "Game" contains management scripts that the controller I'm porting to TinyBirdNet. Each gameobject has an attached TinyNetIdentity and the Asset GUID is correctly set (as part of the prefab saving process). For example, here's what the "Game" gameobject has attached:

image
And I have them in the scene, enabled as usual:
image

However, upon connecting to the server, they get disabled and never get re-enabled (as in, they get grayed out in the inspector). I don't know what's going on, but I have a Network Manager gameobject that contains a very barebones script as follows:

using UnityEngine;
using TinyBirdNet;

public class ExperimentalTinyBirdNetManager : TinyNetGameManager
{
    string hostAddress = "127.0.0.1";
    int hostPort = 31337;

    // Use this for initialization
    private void Start()
    {
        print("ExperimentalTinyBirdNetManager started up");

        instance.SetPort(hostPort);
        instance.StartServer();

        instance.StartClient();
        instance.ClientConnectTo(hostAddress, hostPort);
    }

    public override void ClientConnectTo(string hostAddress, int hostPort)
    {
        base.ClientConnectTo(hostAddress, hostPort);
    }

    public void OnClientReady()
    {        
        print("OnClientReady fired!!");
    }
}

Part 2 of the issue ticket:
What would be the TinyBirdNet Equivalent of this UNET code?

      public override void OnServerAddPlayer(NetworkConnection conn)
        {
            var spawnPosition = Vector3.right * conn.connectionId;
            var player = GameObject.Instantiate(playerPrefab, spawnPosition, Quaternion.identity) as GameObject;
            NetworkServer.AddPlayerForConnection(conn, player);
        }

As you can probably tell, this code is called if you issue a server-side AddPlayer command on the Server side. It would spawn a player object and assign the connection as the owner of that GameObject. I see you either haven't implemented such functions or I'm looking in the wrong place. I cannot use TinyNetPlayerController as the kit I'm using would break and it already uses a lot of RPCs and whatnot for server <-> client communication.

If it's unimplemented then I am going to have to stop porting the kit my project uses to TinyBirdNet because this is a show-stopper.

Sidenote: This looks like a showstopper...
image

@Saishy
Copy link
Owner

Saishy commented Nov 1, 2018 via email

@Saishy Saishy added the bug label Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants