Note that there are some explanatory texts on larger screens.

plurals
  1. POUnity3d: Script changes value of property but nothing happens
    primarykey
    data
    text
    <p>I have set a public property of type Mode (a enum) "mode" for my GameObject's GameManager Monobehaviour, however sometimes, specially on callbacks, asigning a value to said property doesn't do anything:</p> <p>For example:</p> <pre><code>public class GameManager : uLink.MonoBehaviour { public static GameManager instance; public bool dedicated = false; public Mode mode = Mode.MainMenu; public List&lt;Player&gt; players = new List&lt;Player&gt; (); public Player localPlayer; // Use this for initialization void Start () { GameManager.instance = this; } #region Server #region Network void uLink_OnServerInitialized () { Debug.Log ("Server successfully started on port " + uLink.Network.listenPort); new Authenticator ("127.0.0.1", 1234, "DB", "dbUser", "dbPassword"); mode = Mode.ServerDone; } (...) public enum Mode { MainMenu, // ServerInit, //Server start ServerStarting, //Server is starting ServerDone, //Server done loading ClientInit, //Client starting up ClientConnected, //Client connected ClientAwaitAuth, ClientAuthed, //Client authenticated ClientAuthFailed, Client //Client mode } } </code></pre> <p>(This happens both when using Unity3D's network and uLink's network)</p> <p>The callback happens and the Log is placed on the console, the authenticator singleton is created too, but the mode doesn't change. I've tried debugging and placing a breakpoint on <code>mode = Mode.ServerDone;</code> but it then just says "Value not loaded"</p> <p>My code works perfectly if I then manually change the mode to <code>Mode.ServerDone</code> using the editor.</p> <p>My best guess is that this happens because the callback is called by a coroutine that doesn't have the ability to write on the property, but I have no idea how to solve it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload