#Builds not respecting inspector changes [Solved]

1 messages · Page 1 of 1 (latest)

zinc epoch
#
private static void SetPort(ServerKind serverKind)
{
    Tugboat tugboatComponent = GameObject.Find("NetworkManager").GetComponent<Tugboat>();
    CustomFishnetManager customFishnetManager=tugboatComponent.GetComponent<CustomFishnetManager>();
    switch (serverKind)
    {
        case ServerKind.WSL:
            tugboatComponent.SetPort(customFishnetManager.wslPort);
            tugboatComponent.SetClientAddress(customFishnetManager.wslHostAddress);
            break;
        case ServerKind.Dedicated:
            tugboatComponent.SetPort(customFishnetManager.remotePort);
            tugboatComponent.SetClientAddress(customFishnetManager.remoteHostAddress);
            break;
    }
}

[MenuItem("Build/Set Port WSL")]
private static void SetPortWSL()
{
    SetPort(ServerKind.WSL);
}```

I have this editor script that changes the port and client address of a component of a gameobject in the scene. When I build the game, it isn't changed. It's still using the previous settings even though I am using a new build. How is that possible? Is there something I need to do to make sure the chanages are respected in the new build?

```bash
[giorkos@server ~]$ ss -tulpn | grep linuxserverhead
udp   UNCONN 0      0            0.0.0.0:45678      0.0.0.0:*    users:(("linuxserverhead",pid=618493,fd=8))

56789 is the port in the inspector, but in the build 45678 is being used, which is what it had before I ran the script.

ocean rivet
#

If you make scene changes in edit mode you need to either use Undo or editor utilities to mark things as dirty.
Otherwise you won't be able to save the scene with your new changes

#

I think you can also ask unity to prompt to save the scene too in edit mode

zinc epoch
ocean rivet
#

You can use Undo to record the component before your changes and that will be enough

#

Or set dirty 1 thing

zinc epoch
#

You know what, I can't be bothered to test it right now. I'm just gonna mark it as solved because it works

#

Thanks!