Search Unity

Question NetCode 0.4.0 Dont get to spawn a visible prefab

Discussion in 'NetCode for ECS' started by Extrys, Oct 20, 2020.

  1. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    Hello, I'm having a little problem that I'm looking to solve
    I have been following step by step the documentation from here
    https://docs.unity3d.com/Packages/com.unity.netcode@0.4/manual/getting-started.html

    And in the 0.3.0 I got the prefab moving and visible, now I can't, and seems that something related to the spawn has changed? right now I don't get the guide working, the prefabs spawn and even works, but are not vsible, I'm using Hybrid renderer v2, Unity version 2020.2.07b

    can someone give me a helping hand on this, please?
     
  2. kanesteven

    kanesteven

    Joined:
    Aug 30, 2018
    Posts:
    45
    Material on the rendered object must have "GPU instancing" checked.
    Your object must be a Ghost in order for it to be replicated to the clients.
    Your object must be Predicted or Owner Predicted to safely run prediction logic on it ( in a system in the GhostPredictionSystemGroup ).
    Hybrid renderer V2 does not support standard render pipeline. You must be using either URP or HDRP.
     
  3. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    I have GPU Instancing Checked
    My object is a ghost
    The ghost is predicted
    and im using URP

    The ghost works, and spawn, but it is just invisible
     
  4. kanesteven

    kanesteven

    Joined:
    Aug 30, 2018
    Posts:
    45
    Is your ghost collection in a subscene?
    Is the console printing "
    Hybrid Renderer V2 active, MaterialProperty component type count X / Y
    " per the documentation here https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.8/manual/index.html
    Is the Hybrid Renderer package actually installed?
    Are you running your multiplayer client as Server and Client?
    Is your ghost pre-spawned in the world by being a part of your scene or instantiated at runtime?
     
  5. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    upload_2020-10-20_23-1-53.png
    This is my ghost




    upload_2020-10-20_23-2-18.png
    This is the Subscene with the floor and the ghost collection
    and as you see the ghost authoring is referenced in the collection




    upload_2020-10-20_23-4-35.png

    In the debug appears that is connecting properly and the worlds have their respective TestCube entities, and also they work, they are using a system to respond to the WASD input

    upload_2020-10-20_23-6-39.png
    Here is where i spawn it

    abd it worked for me on the 0.3.0 version

    i just followed the steps and it doesnt sees
     
  6. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    yes to everything

    and the ghost is spawned at runtime, since it can not be pre spawned in scene as far as i know
     
  7. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    Also the platform renders
    the problem is on rendering the runtime generated ghost
     
  8. kanesteven

    kanesteven

    Joined:
    Aug 30, 2018
    Posts:
    45
    You can pre-spawn but that's a different conversation. Try removing the BoxCollider as that is a component of legacy Unity Physics and may be causing odd issues. If you want to have collision you'll need to install Unity.Physics and use a PhysicsShape/PhysicsBody.
     
  9. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    thanks for your help, seems that has been a unity bug or something, just restarting unity solved the issue
    Thanks a lot for your time!
     
    kanesteven likes this.