Search Unity

Merry Fragmas 3.0 Q&A

Discussion in 'Community Learning & Teaching' started by richardboegli, Dec 29, 2016.

  1. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    Hi All,

    I've watched all three Merry Fragmas videos and would HIGHLY recommend it.
    Mike Geig has done an AWESOME job.
    Watch on YouTube, Unity's website or Twitch:
    YouTube: Live Training - Merry Fragmas 3.0 - Playlist | Direct: Part1, Part2, Part3
    Unity Website: Live Session: Merry Fragmas 3.0 | Direct: Part1, Part2, Part3
    Twitch: All Videos Direct: Part1, Part2, Part3

    Mike's also done the particle effects as a separate video on his own channel: Merry Fragmas 3.0 Particle Settings which I haven't watched yet.

    I'm in the process of working through them all the videos at the moment and noticed that there doesn't seem to be a thread specific for Merry Fragmas 3.0.

    So here is a thread, to provided support for people working through the videos. As more people finish the videos, they could provide support for others working thru them.

    While Mike mentioned to contact him and the others via Twitter, searching thru tweets first to see if someone has asked the question is not my cup of tea. ;)

    But incase this ever happens to you....
    Don't be like Mike, Apply your Changes!

    https://twitter.com/richard_boegli/status/814323034668400640
    YouTube Sound bite: 47m42s
    Cannot use a embedded link as position gets wiped :(
     
    Last edited: Dec 29, 2016
    BerniceChua and Buhlaine like this.
  2. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    Last edited: Dec 30, 2016
  3. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    That shouldn't happen. Are you sure you dragged the player prefab and NOT the player object in the scene onto the player prefab of the game manager?
     
  4. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    If your player health does not go back to player health max after dying, check to make sure that you put Player Health script in "On Toggle Shared" under your Player Prefab.
     
  5. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @richardboegli, thanks for creating this thread. Sorry for posting in the other thread, when I did a search for
    Code (CSharp):
    1. IndexOutOfRangeException: NetworkReader:ReadByte out of range:NetBuf sz:34 pos:34
    2. UnityEngine.Networking.NetBuffer.ReadByte () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:36)
    and for
    Code (CSharp):
    1. host id out of bound id {0} max id should be greater 0 and less than {0}
    , the other thread showed up, and not this one.

    "Remove and re-add the network identity component on the player prefab. Make sure to hit apply" << tried this, it didn't work for me. T-T

    The other thing: when I asked people in the Unity Discord chat group, everyone was saying that Unity Networking doesn't play well with
    Code (CSharp):
    1. Awake()
    ?? All the advice that they've given me is to either not use Unet or not use
    Code (CSharp):
    1. Awake()
    . Is that true???

    Anyway, I'm gonna repost my question from <https://forum.unity3d.com/threads/merry-fragmas-3-0-stopped-working.448278/#post-2902042> here so everything's all in one place. (Also, I spent a long time gathering all this data, that's why I didn't refresh that other page lol!)

    ~~~~~~~~~~~~~~~~~~~~~~~~~
    I have the same error message, but my progress was towards the end of the 2nd video. So it was only until after I did the IK for the hands in the 2nd video (https://unity3d.com/learn/tutorials...-30-ui-graphics-and-animations?playlist=29690), then I started getting these errors. But prior to that step, everything worked properly the same way as the tutorial.

    Code (CSharp):
    1. host id out of bound id {0} max id should be greater 0 and less than {0}
    2. 0x0000000141509B9B (Unity) StackWalker::GetCurrentCallstack
    3. 0x000000014150B84E (Unity) StackWalker::ShowCallstack
    4. 0x00000001414DA963 (Unity) GetStacktrace
    5. 0x00000001411DCBFA (Unity) DebugStringToFile
    6. 0x00000001411DD06C (Unity) DebugStringToFile
    7. 0x0000000140CC8ED3 (Unity) UNET::NetLibraryManager::CheckHost
    8. 0x0000000140CD013A (Unity) UNET::NetLibraryManager::popDataFromHost
    9. 0x00000001416BDB3E (Unity) NetworkTransport_CUSTOM_ReceiveFromHost
    10. 0x0000000027F21807 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Networking.NetworkTransport:ReceiveFromHost (int,int&,int&,byte[],int,int&,byte&)
    11. 0x0000000027F1B330 (Mono JIT Code) [NetworkClient.cs:698] UnityEngine.Networking.NetworkClient:Update ()
    12. 0x0000000027F1AD0D (Mono JIT Code) [NetworkClient.cs:950] UnityEngine.Networking.NetworkClient:UpdateClients ()
    13. 0x0000000027F1A984 (Mono JIT Code) [NetworkIdentity.cs:1073] UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate ()
    14. 0x000000000D090A8E (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    15. 0x00007FFFCE9154A3 (mono) [mini.c:4937] mono_jit_runtime_invoke
    I get them when I click on the Network Manager in the Hierarchy. The errors keep on repeating forever even if I don't hit the play button in the editor.

    Other symptoms:

    If I use the standalone instance as the host and the editor as the LAN client:
    - In the Hierarchy, neither of the players network objects appear.
    - In the Scene view, none of the networked players appear (only the one inside the Construct scene appears).
    - In the Game view of the editor (which is the LAN client), none of the players appear (only the one inside the Construct scene appears).


    If I use the editor as the host and the standalone instance as the LAN client:
    - In the Hierarchy, ALL the players appear.
    - In the Scene view, ALL the players appear.
    - In the Game view of the editor (which is the LAN host), ALL of the players appear.
    - (please see the screenshot in the attachment) The FirstPersonController script and the FirstPersonCharacter of the remote/not local player are not active, even if the PlayerBehaviorInNetworking script (in the turorial, this script is called "Player") has them toggled to be active.

    For both versions:
    - The local player can move, can shoot things, and the kill count increases if the raycasts hit the "remote" player.
    - There is this harsh sound like a TV with static. This sound stops when the local player's "feet" leave the ground (like when the player is jumping).
    - The remote player is floating in the air, but the idle animation plays. When the "remote" player is shot, it does not play the "death" animation, and just disappears (previously, the death animation was able to play).
    - The editor's console has this error message (occurred once):
    Code (CSharp):
    1. IndexOutOfRangeException: NetworkReader:ReadByte out of range:NetBuf sz:34 pos:34
    2. UnityEngine.Networking.NetBuffer.ReadByte () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:36)[/INDENT]
    3.  
    .
    - The editor's console has these warnings (multiple of them):
    Code (CSharp):
    1.  
    2. [INDENT]Did not find target for sync message for 2
    3. 0x0000000141509B9B (Unity) StackWalker::GetCurrentCallstack
    &
    Code (CSharp):
    1. Did not find target for sync message for 3
    2. 0x0000000141509B9B (Unity) StackWalker::GetCurrentCallstack
    3. 0x000000014150B84E (Unity) StackWalker::ShowCallstack
    4. 0x00000001414DA963 (Unity) GetStacktrace
    5. 0x00000001411DCBFA (Unity) DebugStringToFile
    6. 0x00000001411DD06C (Unity) DebugStringToFile
    7. 0x0000000141166C78 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    8. 0x00000000322F82FB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
    9. 0x00000000322F81E4 (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    10. 0x00000000322F7B75 (Mono JIT Code) [Logger.cs:42] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    11. 0x00000000322F73B6 (Mono JIT Code) [DebugBindings.gen.cs:157] UnityEngine.Debug:LogWarning (object)
    12. 0x00000000322F6E81 (Mono JIT Code) [ClientScene.cs:717] UnityEngine.Networking.ClientScene:OnUpdateVarsMessage (UnityEngine.Networking.NetworkMessage)
    13. 0x0000000023918A2A (Mono JIT Code) [NetworkConnection.cs:468] UnityEngine.Networking.NetworkConnection:HandleReader (UnityEngine.Networking.NetworkReader,int,int)
    14. 0x0000000023917EFB (Mono JIT Code) [NetworkConnection.cs:424] UnityEngine.Networking.NetworkConnection:HandleBytes (byte[],int,int)
    15. 0x0000000023917D9F (Mono JIT Code) [NetworkConnection.cs:576] UnityEngine.Networking.NetworkConnection:TransportRecieve (byte[],int,int)
    16. 0x0000000023908D83 (Mono JIT Code) [NetworkClient.cs:735] UnityEngine.Networking.NetworkClient:Update ()
    17. 0x0000000023907FBD (Mono JIT Code) [NetworkClient.cs:950] UnityEngine.Networking.NetworkClient:UpdateClients ()
    18. 0x0000000023907C34 (Mono JIT Code) [NetworkIdentity.cs:1073] UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate ()
    19. 0x000000000AFC0A8E (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    20. 0x00007FFFCE9154A3 (mono) [mini.c:4937] mono_jit_runtime_invoke
    21. 0x00007FFFCE8683F1 (mono) [object.c:2623] mono_runtime_invoke
    22. 0x00000001411F985F (Unity) scripting_method_invoke
    23. 0x0000000140E2E1A5 (Unity) ScriptingInvocation::Invoke
    24. 0x0000000140CC5E5F (Unity) UNET::ScriptingUpdater::playerLoopUpdate
    25. 0x0000000140BC01AD (Unity) PlayerLoop
    26. 0x000000014147B5C2 (Unity) Application::UpdateScene
    27. 0x000000014147CB8F (Unity) Application::UpdateSceneIfNeeded
    28. 0x0000000141485454 (Unity) Application::TickTimer
    29. 0x00000001415477AE (Unity) FindMonoBinaryToUse
    30. 0x0000000141548DD1 (Unity) WinMain
    31. 0x0000000141863E94 (Unity) strnlen
    32. 0x00007FFFFBBC8364 (KERNEL32) BaseThreadInitThunk
    33. 0x00007FFFFBEC70D1 (ntdll) RtlUserThreadStart
    34.  
    - Whichever is the LAN client, the first person camera is not turned on & the player who is the LAN client cannot move, and floats in the air in the screen of whoever is the host.

    This error message comes out sometimes, but not all the time:
    Code (CSharp):
    1. <RI.Hid> Failed to create device file: 2 The system cannot find the file specified.
    Despite the timing and circumstances of when I started getting the error messages, the error messages seem to lean more towards a networking issue, but I'm not sure. I tried looking online but those solutions seem either unrelated to my issue, or they are just questions in the Unity forums with no answers.

    It appears that NetworkReader.ReadByte is an array, and something is trying to access the outside of that array. Is there a way to go into the code to see what's trying to do that? Is this even a good idea??

    On Unity 5.5.0f3, running Windows10, if that helps.

    Before that, everything worked the same as the videos. So it was only until after I did the IK for the hands in the 2nd video, then I started getting these errors.

    Things that I've tried to troubleshoot:
    - I went through all the code again and through all the videos again to make sure that everything is the same and that I didn't miss anything, including the placement of scripts & GameObjects in PlayerBehaviorInNetworking script (in the turorial, this script is called "Player").

    - https://forum.unity3d.com/threads/understanding-networkreader-readbyte-out-of-range-errors.361115/
    The person said that they just rebuilt everything, which I did. I tried refreshing everything in the editor, applied the changes to the prefabs, and saved everything. Then rebuilt the standalone.

    - http://answers.unity3d.com/questions/1170290/unet-indexoutofrangeexception-networkreaderreadbyt.html
    I didn't see anything on the script that was serialized or deserialized.

    - http://answers.unity3d.com/questions/1104570/unet-transport-layer-host-id-is-out-of-bound-0.html
    This looks different than what we are going through.

    - https://forum.unity3d.com/threads/i...kreader-readbyte-out-of-range-problem.368631/
    This one says that it's caused by:
    I tried refreshing everything in the editor, applied the changes to the prefabs, and saved everything. Then rebuilt the standalone. Is there a cache or something that's keeping the older version of the scripts? If that's the case, how do we refresh that so it has the latest version?

    - https://forum.unity3d.com/threads/host-id-out-of-bound-id-error-on-tank-demo.333596/
    - http://answers.unity3d.com/questions/1104570/unet-transport-layer-host-id-is-out-of-bound-0.html
    Are these the same as our problem??!??

    Any help is totally welcome. Thanks in advance!! ^__^ networkreader-readbyte-out-of-range-captioned.png
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    (By the way, hi @Mike-Geig!! This is Tsai_Ming_Li from Twitch! ^__^)

    (Edited formatting for clarity.)
     
    Last edited: Dec 31, 2016
  6. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    Hey guys.
    Thanks for Merry Fragmas. It's been a great tutorial.
    Like BerniceChua, I started getting IndexOutOfRangeException: NetworkReader: ReadByte out of range: NetBuf sz:30 pos:30.

    One thing I noticed was that if I stop and try to rejoin the client multiple times, eventually I get the error about Spawn Position not found... Don't know that it has anything to do with it.

    I've started the tutorial over a couple times because in video one I encountered this a couple times but this time I was at the point of binding IK for the hands to the hand points...(In fact I built RIGHT before that it worked great)
     
    BerniceChua likes this.
  7. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @richardboegli, out of desperation, I retried this technique of removing and putting back the Network Identity component. This time it worked. I guess the first time I did it, it was still bugged?

    Hi @Mighteemouse, based on what people in this thread and this other thread were observing, the timing of when the bug happens is random. Please try what @richardboegli recommended, which is to remove and put back the Network Identity component. (Please note that if you do this, you'll also need to first remove the Player script component, the Network Transform component, the Player Shooting script, the Player Health script, the Network Animator script, and the Gun Position Sync script; then put them all back after. You'll need to do this, because all of the scripts mentioned depend on the Network Identity script, so you can't remove the Network identity script without removing those.)

    Anyway, for this error message:
    Code (CSharp):
    1. IndexOutOfRangeException: NetworkReader:ReadByte out of range:NetBuf sz:34 pos:34
    2. UnityEngine.Networking.NetBuffer.ReadByte () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:36)
    One of the other things I've seen when I researched for a troubleshooting solution (which I wrote in my original post):
    - https://forum.unity3d.com/threads/i...yte-out-of-range-problem.368631/#post-2404110
    This one says that it's caused by:
    1. you are attempting to connect a client built from older or newer versions of the scripts to a server
    2. you have a mismatch in the number of bytes written and read in an OnSerialze and/or OnDeserialize method
    I think this might be the underlying reason why there's a bug in Network Identity.

    Is there a cache or something that's keeping the older version of the scripts? If that's the case, how do we refresh that so it has the latest version?
     
    Last edited: Dec 30, 2016
  8. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Putting my questions in individual posts, so it's easier to digest:

    For this error message:
    Code (CSharp):
    1. IndexOutOfRangeException: NetworkReader:ReadByte out of range:NetBuf sz:34 pos:34
    2. UnityEngine.Networking.NetBuffer.ReadByte () (at C:/buildslave/unity/build/Extensions/Networking/Runtime/NetworkBuffer.cs:36)
    One of the other things I've seen when I researched for a troubleshooting solution (which I wrote in my original post):
    - https://forum.unity3d.com/threads/i...yte-out-of-range-problem.368631/#post-2404110
    This one says that it's caused by:
    1. you are attempting to connect a client built from older or newer versions of the scripts to a server
    2. you have a mismatch in the number of bytes written and read in an OnSerialze and/or OnDeserialize method
    I think this might be the underlying reason why there's a bug in Network Identity.

    Is there a cache or something that's keeping the older version of the scripts? If that's the case, how do we refresh that so it has the latest version?
     
  9. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    @BerniceChua I ended up doing what @richardboegli had suggested and it got rid of the error but I didn't take good enough screenshots or something and my character models ended up running in place but it connected....
    Instead I used Collab (thank you Unity Team.. it allows me to fulfill my saying of "Check in early and check in often") and rolling back to just before I started working on the gun pivot.
    You do raise a good question of whether there is some form cache that keeps older versions because the oddity i found when i removed everything (and applied the prefab Mike) as soon as I added the Player script back in, it brought in the Network Identity component right along with it which I found a little.... off..

    Anyway.. I'm back to it.. Thank you again Unity Team for Collab.. Source Code control is your friend.
     
  10. Rustygear3

    Rustygear3

    Joined:
    Oct 1, 2016
    Posts:
    4
    Hi everyone. My game system seems to work fine. However the visuals only work correctly if you are the host.
    The Issue with the health appearing as 0 is only fixed on the client. I'll show what it looks like on the host and then the client.

    Host: HostUI.PNG Client: ClientUI.PNG
    The lobby name and color aren't applied in the client view. Again I will show a comparison between host and client.
    Host: OtherPlayersLook(host).PNG
    Client: OtherPlayersLook(client).PNG


    After I took these pictures, I managed to solve why the text won't face the player. I forgot to disable the PlayerNameCanvas but I don't understand why everything works fine on the host but doesn't work on the clients.



     
  11. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Can someone send me a copy of the project getting these index and serialize errors? I've never seen that and would like to play with it.
     
    BerniceChua likes this.
  12. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @Mike-Geig, thanks for all your help!! ^__^

    Sorry, I don't have the errors anymore, because I removed and put back the Network Identity like @richardboegli suggested. But if it comes up again, I'll post the link to my GitHub here.

    OR another person who has the error(s) can send his or her work.

    I have another question though. What's the best way to test and troubleshoot sounds? In my post above, I mentioned that
    The sound seems to come from the player when it touches the "ground", and I turned off Foot IK. Aside from that, where else can people look to troubleshoot that? Thanks in advance.
     
    Last edited: Dec 31, 2016
  13. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    Well crud @Mike-Geig I rolled back. If I get it again, I'll get it to you.
     
  14. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    Unity Serialization Error.PNG Well @Mike-Geig that didn't take long, forgive my newbie-ness of the forums, what is the best way to get you a copy of the project with the error?
    I could add you as a user in my Collab and you could get it there (how dare i check in broken code!!! ;))
    It's about 1GB zipped?

    By the way, I'm using Personal Edition if you think that may make a difference.

    I think that's the last edit...
     
    Last edited: Dec 31, 2016
  15. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    You can add me in Collab. Otherwise, dropbox, drive, etc will work too. Be sure to zip it without the library or build folders
     
  16. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    The thing about this is that in Awake(), the object doesn't know anything about its networked state. It doesn't know if it a server, client, local, etc. Otherwise, it is fine to use them together, just not for networking things.

    I have yet to see those errors ever. I even opened someone else's project who had those errors and I didn't get them. Therefore, I suspect something with the library folder. Try closing Unity, deleting the library folder, and then letting it rebuild. See if the problem persists. If so, send me a copy of it because I am curious

    Hmmm, perhaps this is a bug with uNet interactions with Collab? I've never gotten these errors, but I have also never used Collab with uNet. I know Collab keeps a cache and perhaps that is where our mismatch is coming from. Does anyone else use Collab and also get these issues?

    Did you spell the SyncVar hooks correctly? It must be an error somewhere in your code. Feel free to post relevant bits for use to check out

    I have also noticed that before and not just in Unity. Do you happen to have an Asus motherboard in your computer? I do and it has terrible audio noise that has something to do with screen brightness and also proximity to objects in Unity. I know that sounds super weird, but that has been my experience with my motherboard. Eitherway, I know exactly the sound you are talking about, but I've never figured out how to fix it. It only happens on this computer for me.

    Happy New Years!
     
    BerniceChua likes this.
  17. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    @Mike-Geig - Unintended side effect of disabling capsule (Video 2 - 3m27s) and putting it into remote. Player do not cast a shadow for themselves anymore....
     
  18. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    True, you could set renderers to "Shadows Only" if having first person shadows is important to you.
     
    BerniceChua likes this.
  19. Rustygear3

    Rustygear3

    Joined:
    Oct 1, 2016
    Posts:
    4
    I've tested around in order to see which scripts are working properly. The lobby hook script is passing the information to the player.
    Passed Values.PNG
    However the values are not being applied to any client players.
    NoMesh color.PNG Client game object names.PNG
    Here is the player script I'm pretty sure that the syncvar functions are typed in correctly.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;    //Allows Networking features
    3. using UnityEngine.Events;        //Allows use of events
    4. using UnityEngine.UI;            //Allows UI features
    5. using System.Collections.Generic;    //Allows use of Lists
    6.  
    7. [System.Serializable]
    8. public class ToggleEvent  : UnityEvent<bool>{}
    9.  
    10.     public class Player : NetworkBehaviour {
    11.         [SyncVar (hook = "OnNameChanged")] public string playerName;    //Player name
    12.         [SyncVar (hook = "OnColorChanged")] public Color playerColor;    //Player color
    13.  
    14.         [SerializeField] ToggleEvent onToggleShared;    //Toggle for shared events, viewable in editor.
    15.         [SerializeField] ToggleEvent onToggleLocal;        //Toggle for local events, viewable in editor.
    16.         [SerializeField] ToggleEvent onToggleRemote;    //Toggle for remote events, viewable in editor.
    17.         [SerializeField] float respawnTime = 5f;        //How long it takes for the player to revive
    18.         [SerializeField] CandyCaneMaterialSwitcher candyCaneSwitcher;    //Switches candy cane material
    19.  
    20.         static List<Player> players = new List<Player> ();    //List of players
    21.  
    22.         GameObject mainCamera;        //Main Camera for the local player to enable and disable
    23.         //NetworkAnimator anim;        //Network animator
    24.  
    25.         //Occurs on startup
    26.         void Start(){
    27.             //Gets a reference to the NetworkAnimator
    28.             //anim = GetComponent<NetworkAnimator> ();
    29.  
    30.             //Sets the mainCamera to be the main camera in the scene
    31.             mainCamera = Camera.main.gameObject;
    32.  
    33.             //Calls the EnablePlayer function
    34.             EnablePlayer();
    35.         }
    36.  
    37.         [ServerCallback]    //Function runs on servers
    38.         //When the object is enabled
    39.         void OnEnable(){
    40.             //If players list does not contain this player
    41.             if (!players.Contains (this)) {
    42.                 //Adds this player to the list of players
    43.                 players.Add (this);
    44.             }
    45.         }
    46.  
    47.         [ServerCallback]    //Function runs on servers
    48.         //When the object is enabled
    49.         void OnDisable(){
    50.             //If players list does contain this player
    51.             if (players.Contains (this)) {
    52.                 //Removes this player to the list of players
    53.                 players.Remove (this);
    54.             }
    55.         }
    56.  
    57.         //Occurs every frame
    58.         /*void Update(){
    59.             //if the player isn't the local player
    60.             if (!isLocalPlayer) {
    61.                 return;
    62.             }
    63.  
    64.             anim.animator.SetFloat ("Speed", Input.GetAxis ("Vertical"));
    65.             anim.animator.SetFloat ("Strafe", Input.GetAxis ("Horizontal"));
    66.         }*/
    67.  
    68.         //Disables the player
    69.         void DisablePlayer(){
    70.             //If the player is the local player
    71.             if (isLocalPlayer) {
    72.                 //Hides the player reticule
    73.                 PlayerCanvas.canvas.HideReticule ();
    74.                 //enables the main camera
    75.                 mainCamera.SetActive (true);
    76.             }
    77.  
    78.             //Sets all events in onToggleShared to false
    79.             onToggleShared.Invoke (false);
    80.  
    81.             //If the player is local
    82.             if (isLocalPlayer) {
    83.                 //Sets all events in onToggleLocal to false
    84.                 onToggleLocal.Invoke (false);
    85.             } else {    //If the player is not local
    86.                 //Sets all events in onToggleRemote to false
    87.                 onToggleRemote.Invoke (false);
    88.             }
    89.         }
    90.  
    91.         //Enables the player
    92.         void EnablePlayer(){
    93.             //If the player is the local player
    94.             if (isLocalPlayer) {
    95.                 //Initalizes the canvas
    96.                 PlayerCanvas.canvas.Initialize ();
    97.                 //disables the main camera
    98.                 mainCamera.SetActive (false);
    99.                 //Calls the SwitchMaterial passing in true
    100.                 candyCaneSwitcher.SwitchMaterial(true);
    101.             }
    102.  
    103.             //Sets all events in onToggleShared to true
    104.             onToggleShared.Invoke (true);
    105.  
    106.             //If the player is local
    107.             if (isLocalPlayer) {
    108.                 //Sets all events in onToggleLocal to true
    109.                 onToggleLocal.Invoke (true);
    110.             } else {    //If the player is not local
    111.                 //Sets all events in onToggleRemote to true
    112.                 onToggleRemote.Invoke (true);
    113.             }
    114.         }
    115.  
    116.         //Occurs when the player dies
    117.         public void Die(){
    118.             //If the player is local or doesn't have a playerControllerId
    119.             if (isLocalPlayer || playerControllerId == -1) {
    120.                 //Sets Died animation trigger
    121.                 //anim.SetTrigger ("Died");
    122.             }
    123.             //If the player is the local player
    124.             if(isLocalPlayer){
    125.                 //Writes game status text saying "You Died" and plays the death audio
    126.                 PlayerCanvas.canvas.WriteGameStatusText("You Died!");
    127.                 PlayerCanvas.canvas.PlayDeathAudio ();
    128.             }
    129.             //Disables the player
    130.             DisablePlayer ();
    131.             //Invokes the Respawn function after respawnTime has passed
    132.             Invoke ("Respawn", respawnTime);
    133.         }
    134.  
    135.         //Respawns the player
    136.         void Respawn(){
    137.             //If the player is local or doesn't have a playerControllerId
    138.             if (isLocalPlayer || playerControllerId == -1) {
    139.                 //Sets Restart animation trigger
    140.                 //anim.SetTrigger ("Restart");
    141.             }
    142.  
    143.             //If the player is the local player
    144.             if (isLocalPlayer) {
    145.                 //Sets a spawn location based on the start positions in Network manager
    146.                 Transform spawn = NetworkManager.singleton.GetStartPosition ();
    147.  
    148.                 //Sets the transform position and rotation to equal spawn position and rotation
    149.                 transform.position = spawn.position;
    150.                 transform.rotation = spawn.rotation;
    151.             }
    152.  
    153.             //Enables the player
    154.             EnablePlayer ();
    155.         }
    156.  
    157.         void OnNameChanged(string value){
    158.             //Changes playerName to the value
    159.             playerName = value;
    160.  
    161.             //Changes the game object name to playerName
    162.             gameObject.name = playerName;
    163.  
    164.             //Gets the Text component and changes the text to playerName. Passes in true in order to search for a deactivated object.
    165.             GetComponentInChildren<Text> (true).text = playerName;
    166.         }
    167.  
    168.         void OnColorChanged(Color value){
    169.             //Changes the player color to the value
    170.             playerColor = value;
    171.             //Changes the color of the player through the renderer toggler script
    172.             GetComponentInChildren<RendererToggler> ().ChangeColor (playerColor);
    173.         }
    174.  
    175.         [Server]//Function can only be run on a server
    176.         //Occurs when a player won
    177.         public void Won(){
    178.             //Loops through all of the players and calls RpcGameOver passing in netID and name
    179.             for (int i = 0; i < players.Count; i++) {
    180.                 players [i].RpcGameOver (netId, name);
    181.             }
    182.  
    183.             //Go back to Lobby after 5 seconds
    184.             Invoke("BackToLobby", 5f);
    185.         }
    186.  
    187.         [ClientRpc]//Function is invoked on clients from a server
    188.         //Shows who won based on NetworkID and player name
    189.         void RpcGameOver(NetworkInstanceId networkID, string name){
    190.             //Disables the player
    191.             DisablePlayer();
    192.  
    193.             //Displays the mouse and allows you to move the cursor
    194.             Cursor.lockState = CursorLockMode.None;
    195.             Cursor.visible = true;
    196.  
    197.             //If the player is local
    198.             if (isLocalPlayer) {
    199.                 //If netID is equal to networkID
    200.                 if (netId == networkID) {
    201.                     //Updates the Game status text to You Won!
    202.                     PlayerCanvas.canvas.WriteGameStatusText ("You Won!");
    203.                 } else {    //Otherwise
    204.                     //Updates the Game status text to Game Over
    205.                     PlayerCanvas.canvas.WriteGameStatusText ("Game Over!\n" + name + " Won");
    206.                 }
    207.             }
    208.         }
    209.  
    210.         //Returns to the Lobby
    211.         void BackToLobby(){
    212.             //Finds the NetworkLobbyManager and returns to the lobby
    213.             FindObjectOfType<NetworkLobbyManager> ().SendReturnToLobby ();
    214.         }
    215.  
    216.     }
     
  20. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Thanks, @Mike-Geig!! So that's what they meant in https://forum.unity3d.com/threads/forcing-unity-to-rebuild-the-project.63996/ and https://forum.unity3d.com/threads/understanding-networkreader-readbyte-out-of-range-errors.361115/ when they said "creating a new build":
    They didn't mean a build for a new standalone app, they meant rebuilding by recreating the Library folder. Too bad there's no way to do it within the framework, and we have to delete it manually.

    I guess recreating the Library folder solves the
    Rebuilding the Library folder also seems to have gotten rid of the sound stuttering. :D

    Yes, my motherboard is an Asus X99-A. In the beginning of this tutorial, when I used the FirstPersonController script, as well as the Merry Fragmas 2.0 version, I didn't have this problem though. And when the sound problem appeared, it's only when the player character is on the ground. During the "jump" mode, the stuttering disappears. After rebuilding /Libraries, the sound problem went away too.
     
    Last edited: Jan 3, 2017
  21. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    @BerniceChua
    As for the IndexOutOfRangeException with NetworkReader
    I deleted the library folder and rebuilt, the build errored. Rebuilt.. Still got the error and @Mike-Geig was able to reproduce it with my project so I logged a bug. I'll let you know what comes of it as soon as I get word.
    Thanks again @Mike-Geig for taking the time especially over a holiday to confirm that I'm not an idiot (well, that I can copy and paste code correctly)
     
    BerniceChua likes this.
  22. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Thanks! ^_^

    I guess when he said this, this was before he got the error again:
     
  23. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    Yeah, he PMed me and told me he couldn't get it reproduced (I didnt specify hosting on the built client and joining from the editor.. don't know if that was the directions that allowed him to reproduce it or if the stars just mis-aligned.)

    I think (based on his inability to reproduce it at first, then on what i saw on some of the other forums posts) that it's some sort of cache somewhere and it's really not consistent at all. (The BEST kind of bugs are the ones that can't be reproduced consistently..)

    As an aside, I deleted the library and the temp as suggested in a couple other posts to no avail, I have not however tried what others have said which was "if you restart enough times it will work" just because I feel like it's in the right hands now.
     
  24. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Nevermind, the stuttering is still there. When I tested it inside the editor as a single player, it was gone, but I didn't test with the standalone games. When I did local LAN multi-player (both the editor & standalone, AND standalone & standalone), that's when the stuttering appears again. It only seems to appear when there are 2 players or more.

    I ended up just commenting out anything related to the sounds inside the FirstPersonController.cs script, and the stuttering went away.

    There's also no stuttering when I disable the Audio Source component of the Player, or when I turn off the sound effects audio mixer, but leave the background music turned on.

    Hm, after reading what I typed, I suddenly thought of something. The Audio Source component of the Player gets its sounds from FirstPersonController.cs for the footsteps and the jumping and landing sounds. But since FirstPersonController.cs is disabled for not-local players, @Mike-Geig, do you think that messes up the sound?

    I'm gonna try that out, and report back on the results.
     
    Last edited: Jan 4, 2017
  25. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    OK, so here are the results of what I tested when I uncommented the audio parts of FirstPersonController:

    When I played the game as a single player in the editor, the sounds are all right. Under the "Audio Source" component, in the AudioClip field, the audio clips change to whatever the appropriate sound effects are (i.e. the footsteps while walking, the jump sound while jumping, and the landing sounds while landing).

    When I played the game as a single player in the standalone, the stuttering appears. When I turn off the background music, but leave the sound effects turned on, the stuttering continues. When I turn off the sound effects, but leave the background music turned on, the stuttering stops.

    When I played the game as 2 players in 2 instances of the standalones, the stuttering appears. When I turn off the background music, but leave the sound effects turned on, the stuttering continues. When I turn off the sound effects, but leave the background music turned on, the stuttering stops.

    When I played the game as 2 player, with either the editor as the host and the standalone as the client; or the client as the host and the standalone as the client, the stuttering appears. When I turn off the background music, but leave the sound effects turned on for either the editor or the standalone, the stuttering continues. When I turn off the sound effects, but leave the background music turned on in the editor, the stuttering continues. When I turn off the sound effects, but leave the background music turned on in the standalone, the stuttering stops.

    It seems that the sound problems are in the standalone only. I tried totally rebuilding by deleting the .exe file and its accompanying DATA folder to see if something there was affecting it, but same results.
     
  26. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Also, there's something funny going on with the character when the editor is in Play mode.

    Hey @Mike-Geig, I have a question about dragging and dropping the files into the components. Does it point to the space in memory where those components are stored, or are they pointing to instances of those things? I mean, if I click "Apply" to save my prefabs, do I need to re-drag and drop all prefabs each time?

    My test character inside the "Construct" scene seems ok. Its Y-axis is 0, so the feet are touching the floor. Also, the "Gun Pivot" game object is where it's expected to be under "FirstPersonCaracterController" game object.
    editor-is-not-playing-(captioned).png

    I double checked that the prefab is saved correctly: In the prefab, the Y-axis is zero, and the GunPivot is the child object of FirstPersonCharacterController (in your tutorial, it's called "Player").
    prefab-was-saved-(captioned).png

    But then... when it is running in Play mode, the Y-axis is above zero, so the character is floating even though gravity is turned on. Also, the GunPivot game object moves to be a child object of FirstPersonCharacter, instead of the player itself.
    editor-is-running-single-player-(captioned).png

    (If I didn't know any better, the reason why the sound is stuttering is because the character is trying to land on the ground, so that sound just keeps repeating itself.)

    Just to be safe, I re-dragged & dropped the FirstPersonCharacterController prefab into the Lobby Manager, but still the same result.
     
    Last edited: Jan 4, 2017
  27. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    @BerniceChua this might seem completely unrelated, but what OS are you running?
    There are some strange oddities with Windows10 and certain audio drivers which cause some noise to appear.
    I mention this, because I had it happen to me, but only in some applications and under certain conditions.
     
  28. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @richardboegli, yes, you're right about my operating system being Windows 10!! I did mention it here (https://forum.unity3d.com/threads/merry-fragmas-3-0-q-a.448473/#post-2902049), but that was a very long post because I was asking about multiple error messages, so probably a lot of people missed it.

    Yeah, those were really specific conditions The audio stuttering only happens if the footsteps/jumping/landing sounds are turned on in the FirstPersonController script.

    @Mike-Geig also mentioned that there might be an issue with the motherboard, since a stuttering like that happens when he uses Unity in his computer that has an Asus motherboard.

    I think I will start over from scratch, see if the footstep/jumping/landing audio clips still give me problems, and see if that gets rid of the strange problem about the prefab not saving properly that I mentioned in https://forum.unity3d.com/threads/merry-fragmas-3-0-q-a.448473/#post-2906852
     
  29. richardboegli

    richardboegli

    Joined:
    Dec 28, 2016
    Posts:
    13
    You did indeed. :) and I did miss it ;)
    I was in a rush, so I didn't actually check....:rolleyes:


    Well I would suggest the following for both @BerniceChua and @Mike-Geig, have a look at this forum:
    https://www.tenforums.com/drivers-hardware/12589-windows-10-popping-sound-speakers-2.html
    and try a few of the suggestions if the below suggestion doesn't work.
    Note: For some reason site doesn't load correctly in Pale Moon (Firefox 27 based), but loads in Chromium.

    The solution that worked for me:
    1) Press Windows Key and type in "sound" (without quotes) to get sound control panel
    2) Right click your playback device and select properties
    3) Advanced tab
    4) Change the default quality from whatever it is to 16bit 44100Hz CD quality

    I believe there is a problem with some Realtek audio drivers and Windows 10.

    FYI, I don't get any crackling.

    Good luck! Let me know if either of you are successful.
     
  30. Mighteemouse

    Mighteemouse

    Joined:
    May 9, 2015
    Posts:
    7
    Just a follow up @BerniceChua and @Mike-Geig
    I got an email today that my case about the IndexOutofRange has been duplicated and forwarded to developers.
    Stay tuned!!
    thanks again @Mike-Geig
     
    BerniceChua likes this.
  31. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Yep, still waiting for some more info. Will let everyone know
     
  32. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Interesting. You obviously cared a lot more than me about this. I always just put some music on if it gets annoying :)

    Perhaps there is some incompatibility between ASUS mobo drivers and Unity audio? Could you submit a bug about it and let me know the case number? I will ask around about it.
     
  33. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Hmm, can't tell from what's posted here. Can you send me a copy of the project and I will check it out?
     
  34. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    A few things here:

    1) Prefabs will save links to assets (files in the project view) but it will not save links to game objects. This is because assets will always be assumed to exist, but there is no telling if a game object exists (for example, if you use the same prefab in a different scene).

    2) The gun pivot moves because the gun position sync script tells it to for the local player. This is normal behavior (so the gun stays on screen when looking around)

    3) The character floating issue is due to how the character controller works and where it is looking for the ground. I remember encountering this as well and resolving it by playing around with the y-offset and height of the controller. You could also modify the script to fix it, but I was trying to avoid touching scripts I didn't own.
     
    BerniceChua likes this.
  35. Rustygear3

    Rustygear3

    Joined:
    Oct 1, 2016
    Posts:
    4
    I think I have managed to solve the issue with the player name and color not being applied to client players. I simply changed when the OnColorChanged and OnNameChanged functions were being called.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Networking;    //Allows Networking features
    3. using UnityEngine.Events;        //Allows use of events
    4. using UnityEngine.UI;            //Allows UI features
    5. using System.Collections.Generic;    //Allows use of Lists
    6.  
    7. [System.Serializable]
    8. public class ToggleEvent  : UnityEvent<bool>{}
    9.  
    10.     public class Player : NetworkBehaviour {
    11.         [SyncVar] public string playerName;    //Player name
    12.         [SyncVar] public Color playerColor;    //Player color
    13.  
    14.         [SerializeField] ToggleEvent onToggleShared;    //Toggle for shared events, viewable in editor.
    15.         [SerializeField] ToggleEvent onToggleLocal;        //Toggle for local events, viewable in editor.
    16.         [SerializeField] ToggleEvent onToggleRemote;    //Toggle for remote events, viewable in editor.
    17.         [SerializeField] float respawnTime = 5f;        //How long it takes for the player to revive
    18.         [SerializeField] CandyCaneMaterialSwitcher candyCaneSwitcher;    //Switches candy cane material
    19.  
    20.         static List<Player> players = new List<Player> ();    //List of players
    21.  
    22.         GameObject mainCamera;        //Main Camera for the local player to enable and disable
    23.         //NetworkAnimator anim;        //Network animator
    24.  
    25.         //Occurs on startup
    26.         void Start(){
    27.             //Gets a reference to the NetworkAnimator
    28.             //anim = GetComponent<NetworkAnimator> ();
    29.            
    30.             //Changes the player color and player name
    31.             OnColorChanged (playerColor);
    32.             OnNameChanged (playerName);
    33.            
    34.             //Sets the mainCamera to be the main camera in the scene
    35.             mainCamera = Camera.main.gameObject;
    36.  
    37.             //Calls the EnablePlayer function
    38.             EnablePlayer();
    39.         }
    I'm still unsure about the health being 0 on the client so I just changed the score value text to 3 as a temporary fix.
     
    BerniceChua likes this.
  36. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    I'm also getting some weird behavior with setting the player name and color.

    The OnNameChanged hook isn't getting called on the client for the server character, however it is for the clients own character (checked by adding debug messages). OnColorChanged is getting called for both.

    On the server, OnNameChanged and OnColorChanged successfully run for both characters.

    Like @Rustygear3 I'm able to get the desired behavior by manually calling OnNameChanged and OnColorChanged from the Start method.
     
  37. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Hmm, you shouldn't need to do that though. Can you send me a copy of the project in non-working order for me to check out?
     
  38. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Just wanted to say that I appreciate this tutorial a lot. Really cool to see that you can get a multiplayer game up and running in such a short amount of time. This was the tutorial I wanted for the Tanks networking project, but never got. :)

    I'm still confused as to how all of this can work, but I guess it's the high level API that makes it so confusing. All the weird tags and magic functionality everywhere. :p I'm not even sure if the tags are a Unity feature or a C# feature. I guess I need to do a whole lot of reading to make sense of it.

    I also think that I would like to keep a separate prefab for remote players and local players or something like that because all the toggling of functionality and isLocal everywhere in the code seems like it could lead to a lot of confusion down the line, but I have no experience with multiplayer games apart from this tutorial so I guess I need to try and make an actual game first to see what makes sense to me.

    I also wanted to note for anyone else wanting to follow this tutorial that I followed it using the character from the Angrybots tutorial. He's similar to the character used in this tutorial and he has the same type of rig and the same animations as the character used in this tutorial. He also comes with a weapon. He's a much better fit than the Stealth character in my opinion. That character is available here:
    https://www.assetstore.unity3d.com/en/#!/content/12175

    Addendum: For anyone interested in avoiding floaty animations or slipping, here's a long drawn out explanation on how to approach fixing it without using root motion:

    I noticed during the tutorial that there was some talk about floaty animations or slipping. Slipping is caused by your character moving at a different velocity than the one that's "implied" by the animation currently playing. So all you need to do to eliminate slipping is to make sure your character always moves at the correct speed for the animation currently playing. Using root motion will do this for you, but in my opinion using root motion makes it feel like you're in the driver seat of a tank or a mech rather than actually in control of your character. I've always hated it and therefore never used it, but I also hate slipping, it's the clearest sign of an unpolished game in my opinion. :p

    So if you're not using root motion, but you still want to avoid slipping you need to make sure you're always passing in values to Mecanim that makes the animation play back at the correct speed in relation to the velocity your character is moving. In this tutorial we pass in our input values directly as the values for speed and strafe. This will not work. For example this will give us 100% slipping if we're moving against a wall or an obstacle because our animation will be playing at full speed while we're not even moving. And we're not even sure if we avoid slipping if we're moving at full speed because we've never checked our values against our animations.

    Fixing this requires you to find some magic numbers for your own setup. First of all you need to find the character velocity that fits your game, this would for example be your character's walk and run speed, you completely ignore animations at this point, gameplay first! :) When you have these values then you try to find the correct values to pass into Mecanim to make the animation play back at the correct speed to match your character's velocity. If you don't have any blend trees then you only need to worry about the animation playback speed, but if you have blend trees then you also need to make sure you're blending by the correct amount based on how your character is moving. Ultimately it's just a lot of trial and error and tweaking, i.e. polish. :) In my opinion there's no reason why you should have slipping in your game. However, I've never made a multiplayer game so I don't know how this would look when you introduce lag etc.. So for all I know you may need to take special considerations when making a multiplayer game.

    Back to this tutorial in particular. For me the slipping was caused by the first person character controller script (which I think is only suitable for very basic prototyping to begin with), passing the input values into Mecanim rather than the character's velocity, and because the animations for my character was not configured the way I wanted them inside Unity. Rotation, position, center of mass etc. were setup to use Mecanim or root motion or something like that in the animations tab for the character. When I changed them so that Unity didn't mess with them (You set them to "Original" or something I think) it immediately looked a whole lot better. I also don't think that enabling "Foot IK" for your animations does anything for you if you do this, I think that's only used if you let Unity mess with your animations, but I'm not sure about this, I at least can't see any difference between having this on or off with my setup. I don't know if the same is the case for the character used in the tutorial, but anyone following this will undoubtably have a lot of the same issues. To fix the slipping you need to make your own character controller or severely alter the existing one, but like I said if you intend to make a shippable game you should get rid of the first person character controller script right away anyway because it's just a very rough example of how to move your character.

    Basically, even though it's not related to this tutorial at all, I just wanted to note for anyone wondering that it's possible to fix this problem entirely by just spending some time on it. You'd probably spend more time on this that the entire tutorial which is why it's something you don't spend time on unless you're actually intending to make a polished game.
     
  39. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Just checking if you every got a copy of this, if not I have a copy of the project with the same issue I could share.
     
  40. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    I just tested this project with a friend just to see how and if it worked and to get an idea of how lag would affect it and I'm happy to say it worked perfectly, but there's a noticeable difference in lag between connecting directly to an IP and using the Matchmaker.

    I thought the Matchmaker would just help establish the initial connection, but after that it behaved like normal peer to peer, but it seems all communication goes through the Matchmaker and thus it introduces extra lag?

    Is there a place I can read about this? Is there something one can do to remedy this? Or is it like this for all online games?
     
  41. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    I downloaded and tested the project of @Rustygear3 and it worked just fine without any code modification. I tried debugging as the server and the client and everything worked fine. I ensured that the hooks fired off and the values transferred. I'm not sure what is causing the problem on your system. Are you possibly running an older build and not seeing your updates?
     
  42. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Feel free to share yours and we can see if it is the same issue or different
     
  43. levi_barrocas

    levi_barrocas

    Joined:
    Jan 24, 2017
    Posts:
    1
    I am having a problem where my GunPivot moves to a very strange position in front of my character when i connect another player to the server.As soon as i connect another player to the server my GunPivot moves like 2 units forward and my player model stretches his hand trying to hold the gun. Any ideas what would cause this?

    Edit: Actually it seems that it does not matter if i connect or do not connect another player,as soon as a player is created my gunpivot in non local players decides to move a few units in some directions and rotate in some directions till it is floating in front of the character looking to the right >.>

    Edit 2: Still not solved the first problem,but now my lobby manager is doing the same as some people above and not summoning the player prefab for any connecting player.Only the host gets a player prefab but any other player spawn one when connected.

    Edit 3: 12 hours later... I redone the whole tutorial from the beginning didnt have problems this time.
     
    Last edited: Jan 25, 2017
  44. Mike-Geig

    Mike-Geig

    Unity Technologies

    Joined:
    Aug 16, 2013
    Posts:
    254
    Heh, OK sounds like you got it. For the sake of posterity though, I'm not sure what could have caused the problems you were experiencing. In situations like that, we'd need to see more code or screenshots to be of any assistance.

    Glad you got it this time though!
     
  45. Vekoro

    Vekoro

    Joined:
    Nov 28, 2014
    Posts:
    3
    Hey peoples! I love that tutorial series and i like to learn more about the new multiplayer from Unity. I have two questions:

    What do i need to think about, if i can see a player shoot a projectile (rocket/grenade) and the other players cant see what is going on there?

    Each player can shoot for themself, but over the network the others cant see.
    (They also cant see the direction the other player is aiming, so the rocket is flying in a line in front of the player, ignoring where they pointed to shoot.
    But each player see for himself its working (so if host or client shoot and just watch own screen, they both feel it works, but if you look at network, it seems he dont want to sync it).

    So what is the main explaination i always need to think about if i want to make it visible for both?

    There is a new object created in the scene, the rocket.
    The rocket have its own script. (explosionpower, blastradius)
     
    Last edited: Feb 12, 2017
  46. Quigs101

    Quigs101

    Joined:
    Jan 24, 2017
    Posts:
    1
    The Tutorial has been great so far, working on the second one now. You said in the video that you would make the PlayerCanvas prefab available. Was just wondering if that was the case and where I could find it? Or if i should go about recreating that on my own?

    Thanks
     
  47. Supersilvers

    Supersilvers

    Joined:
    Jun 16, 2015
    Posts:
    3
    YES i would also like the PlayerCanvas prefab, just so i can see how its setup. please can u link us?
     
    supinie and greatkourosh like this.
  48. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    For that matter — chiming in late here — is the whole finished project available for download somewhere? I'd love to test the project and see how well it works in its finished state before I invest several hours building it myself. (I'm still not 100% sure which networking layer I'm going to settle on.)
     
  49. GhostPersona

    GhostPersona

    Joined:
    Apr 5, 2017
    Posts:
    1
    Greetings, I have a weird interaction happening when I play online with friends. The non-host players are, after moving from spawn, able to shoot and, in some cases, kill themselves. Did this happen to anyone else? I figured it could be something with the colliders over a network but I'm new to multiplayer networking so I am unsure. Is there a simple solution to not allowing the player shooting to not hit their own collider?
     
  50. greatkourosh

    greatkourosh

    Joined:
    Apr 26, 2017
    Posts:
    3
    Hi everyone.
    I just recently joined the Unity community to start learning.
    and I'm confused if I should start from merry fragmas I and then 2 & 3? or its okay to just learn the 3? as I played the first video of the merry fragmas 3 and it starts with a complete scene.
    The other learning series, 2D Roguelike and Tanks! and Space Shooter, started from scratch.
     
    BerniceChua likes this.