Search Unity

Getting started with NetCode Error CS1503

Discussion in 'Multiplayer' started by TheJumpingKid, Feb 2, 2020.

  1. TheJumpingKid

    TheJumpingKid

    Joined:
    Oct 23, 2013
    Posts:
    3
    Trying to follow:
    https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/getting-started.html

    Got the following error below after installing all the required Assests. Any ideas?

    Library\PackageCache\com.unity.netcode@0.0.4-preview.0\Runtime\ClientServerWorld\ClientServerBootstrap.cs(31,33): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.IReadOnlyList<System.Type>' to 'System.Collections.Generic.List<System.Type>'
     
    tgienger, T-Zee and johnroodt like this.
  2. tgienger

    tgienger

    Joined:
    Jul 18, 2013
    Posts:
    45
    Same thing for me as well.
     
  3. josh1st

    josh1st

    Joined:
    Dec 17, 2016
    Posts:
    2
    Yeah same for me aswell

    edit: its the same problem regardless of which build I use, both 2019.3.0f6 or 2020.1.0a21
     
  4. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Same thing for me.
    I'm not in the habit of editing core unity scripts but changing:
    Code (CSharp):
    1.             var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
    2.             GenerateSystemLists(systems);
    to :
    Code (CSharp):
    1.             var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
    2.             GenerateSystemLists(systems as List<Type>);
    makes the error go away and allows you to compile...
     
  5. josh1st

    josh1st

    Joined:
    Dec 17, 2016
    Posts:
    2
    Works! thanks!
     
  6. TheJumpingKid

    TheJumpingKid

    Joined:
    Oct 23, 2013
    Posts:
    3
    Thanks for the help. Now I am running into another error with the CubeGhostUpdateSystem.cs
    Error: Assets\CubeGhostUpdateSystem.cs(237,46): error CS0019: Operator '==' cannot be applied to operands of type 'quaternion' and 'int'

    Code:
    Code (CSharp):
    1. struct SetPredictedDefault : IJobParallelFor
    2.     {
    3.         [ReadOnly] public NativeArray<CubeSnapshotData> snapshots;
    4.         public NativeArray<int> predictionMask;
    5.         [ReadOnly][DeallocateOnJobCompletion] public NativeArray<NetworkIdComponent> localPlayerId;
    6.         public void Execute(int index)
    7.         {
    8.             if (localPlayerId.Length == 1 && snapshots[index].GetRotationValue() == localPlayerId[0].Value)
    9.                 predictionMask[index] = 1;
    10.         }
    11.     }
     
  7. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    I got a crash right after clicking "Update Component List" :rolleyes:
     
  8. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Same.
    Resolve this crash by entering /Scripts/Generated in the Root Path field on the Ghost Authoring Component, then click "Generate Code" button, then click "Update Component List" button.

    After configuring the component, click "Generate Code" button again to update code to reflect your changes. (Not sure if this is necessary, but made sense to my limited understanding of this new system.)
     
    shiena likes this.
  9. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Be sure to set the "Name Prefix" field in the Ghost Collection Authoring Component to NetCube.
    It defaults to the name of your project.
     
    Last edited: Feb 5, 2020
  10. MMOERPG

    MMOERPG

    Joined:
    Mar 21, 2014
    Posts:
    50
    Change:
    Code (CSharp):
    1.             if (localPlayerId.Length == 1 && snapshots[index].GetRotationValue() == localPlayerId[0].Value)
    2.                 predictionMask[index] = 1;
    to:
    Code (CSharp):
    1.             if (localPlayerId.Length == 1 && snapshots[index].GetMovableCubeComponentPlayerId() == localPlayerId[0].Value)
    2.                 predictionMask[index] = 1;
     
  11. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    Oh yea sorry I didn't mention I already did this.. it wasn't that hard Googling that workaround but thanks :)

    Also when creating a project with spaces in its name, the "Generate code" also generate problems.. so you need to manually remove the spaces from classes names
    but this is a minor issue...
     
  12. tgienger

    tgienger

    Joined:
    Jul 18, 2013
    Posts:
    45
    Dots as well. I had a dot in one projects name for the unity version and had to change it all :)
     
    RoyBarina likes this.
  13. Yeisonlop10

    Yeisonlop10

    Joined:
    Jan 10, 2018
    Posts:
    19
    Thanks for the help guys. I follow the suggestions and suddenly the errors disappear but Unity crashes. So i downloaded the sample project they have on this link and one scene contains the netcode example

    https://github.com/Unity-Technologies/multiplayer
     
    Last edited: Feb 14, 2020