Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

42

Found in

5.6.0f3

Issue ID

902995

Regression

No

Awake of NetworkBehaviour is not called at launch in standalone build, but is in the Editor

Networking

-

In Editor, Awake and Start functions are called as follows: Awake in Networked object, Awake in local object, Start in local object, Start in Networked object
In Player, Awake and Start functions are called as follows: Awake in local object, Start in local object, Awake in networked object, start in Networked object

To reproduce:

1. Open the project, attached by tester
2. Open "test" scene if not open
3. Press Play
4. Create Host
4. Observe the console
5. Stop the game
6. Build and run a standalone
8. After it has launched, create Host and close the game
9. Go to {standaloneName}_Data folder and open output_log.txt file
10. Observe the order of outputs from Awake and Start methods

Expected: Awake and Start methods are called in the same order on MonoBehaviour and NetworkBehaviour objects no matter if it is in Editor or in standalone build
Actual: the execution order of Awake and Start methods in Editor are diferrent than in standalone build when using NetworkBehaviour

Reproduced on 5.4.5p1, 5.5.3p1, 5.6.0p2, 2017.1.0b1

Comments (11)

  1. D4aaf2daf76fadf082c08dc056dba467?d=mm

    spidermancy612

    May 03, 2019 14:16

    Quick update for anyone who finds themselves here like I did. The issue is still persistent in Unity 2018 1.0f2.

    Also to add to it. Awake/Start cannot run on any class inheriting from NetworkBehavior as well as will not run on any object with a network component as far as I can tell. To get around this you can create a separate GameObject without any networking on it, then attach a Monobehavior class to it, you can then run the awake/start methods there.

  2. 69f5ba965dede0d7f4a142735e162807?d=mm

    romikula

    Mar 11, 2018 20:11

    Confirming the issue, neither Awake, Start nor Enable are working when inheriting NetworkBehaviour :(

  3. Bc39b8f327c5525e68344e45f6a26e45?d=mm

    RikuTheFuffs

    Feb 13, 2018 09:52

    Is it possible that this bug is still active after one year? I'm using 5.5.5p1 where this issue doesn't seem to appear, but I'd really like to update to 5.6 and can't do that.

  4. 7bd303646272466a7cadba2f9421105a?d=mm

    Chikari

    Jan 02, 2018 19:51

    Still a problem for 2017.3.

  5. 34ce1b11fc95f33304a0f2a94a855738?d=mm

    Kailric

    Aug 28, 2017 15:39

    I just noticed this issue as well in 2017 build. I have been using the Unity created LobbyManager Asset and the NetworkBehavior objects start as they should. But when I created my own means to start a match the Start and Awake functions no longer work in standalone.

  6. 1042c4fb2496bcb86983eb8f46a8eed6?d=mm

    berkersonmez

    Jul 02, 2017 15:28

    This is very severe please fix.

  7. Af3054c9bbc2824ba67c9223a84f3840?d=mm

    flinter

    Jun 30, 2017 02:35

    In my case I have screen with buttons like Start Server, Start Client and etc.

    I made script from PHAEM (because just call broadcast doesn't work.

    public class ForceAwake : MonoBehaviour
    {
    public MyNetworkManager manager;
    private void Awake()
    {
    manager.gameObject.SetActive(true);
    }
    }

    I see in the log that component Awaked.
    But in my method NetworkManager.singleton is equal NULL

    When I pressed button, (just UI Button) it works normally.

    It is so bad issue :(((

  8. 041eaf846884e5d75f0be78d3398789b?d=mm

    andyasj

    May 12, 2017 16:59

    I have a working editor project but in build awake not called AT ALL for one NetworkBehavior.

  9. 07ad40de032d93bb77f395e81543c9da?d=mm

    phaem

    May 12, 2017 08:34

    I solved those issues using this script on parent objects:

    public class ForceAwake : MonoBehaviour
    {
    private void Awake()
    {
    BroadcastMessage("ForcedAwake");
    }
    }

    This way it works in standalone exactly as in editor.

  10. D01d400c6c5ddb428da17144b9239dc3?d=mm

    ownself

    May 10, 2017 03:24

    This happens all the way from 5.4 to 5.6, still not fixed, I wonder how the developer not notice this...

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.