Skip to content

Commit

Permalink
Add NetConfig in subscene
Browse files Browse the repository at this point in the history
  • Loading branch information
jeickhoff committed May 29, 2023
1 parent 5ec0dbc commit 5445f43
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 68 deletions.
70 changes: 4 additions & 66 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ MonoBehaviour:
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
Expand Down Expand Up @@ -306,7 +307,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &410087039
GameObject:
Expand Down Expand Up @@ -574,7 +575,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -630,69 +631,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1241187973
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1241187976}
- component: {fileID: 1241187975}
- component: {fileID: 1241187974}
m_Layer: 0
m_Name: Config
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1241187974
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2abf6eb54a2904264a2d35b357ad751c, type: 3}
m_Name:
m_EditorClassIdentifier:
LogLevel: 2
DumpPackets: 0
--- !u!114 &1241187975
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5bd6bf266b32e49ac8c5951317b6b250, type: 3}
m_Name:
m_EditorClassIdentifier:
EnableLagCompensation: 1
ServerHistorySize: 0
ClientHistorySize: 0
ClientNonGhostWorldIndex: 0
--- !u!4 &1241187976
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.19083357, y: 0.64592344, z: 3.638323}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2101193216
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -759,5 +697,5 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
82 changes: 80 additions & 2 deletions Assets/Scenes/SampleScene/SampleSubScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ MonoBehaviour:
type: 3}
seed: 43
initialAreas:
x: 100
x: 1
y: 1
z: 100
z: 1
maxChunkSpawnsPerTick: 8
blocksPerChunkSide: 4
YBounds:
Expand Down Expand Up @@ -287,6 +287,84 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1241187973
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1241187976}
- component: {fileID: 1241187975}
- component: {fileID: 1241187974}
- component: {fileID: 1241187977}
m_Layer: 0
m_Name: NetConfig
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1241187974
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2abf6eb54a2904264a2d35b357ad751c, type: 3}
m_Name:
m_EditorClassIdentifier:
LogLevel: 2
DumpPackets: 0
--- !u!114 &1241187975
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5bd6bf266b32e49ac8c5951317b6b250, type: 3}
m_Name:
m_EditorClassIdentifier:
EnableLagCompensation: 0
ServerHistorySize: 0
ClientHistorySize: 0
ClientNonGhostWorldIndex: 0
--- !u!4 &1241187976
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.19083357, y: 0.64592344, z: 3.638323}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1241187977
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1241187973}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c5a972dcfbe1d0c4b90f47b0f785cb02, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkTickRate: 20
SimulationTickRate: 20
--- !u!1 &1661226946
GameObject:
m_ObjectHideFlags: 0
Expand Down
23 changes: 23 additions & 0 deletions Assets/Scripts/Networking/NetConfigAuthoring.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Unity.Entities;
using Unity.NetCode;
using UnityEngine;



public class NetConfigAuthoring : MonoBehaviour
{
public int NetworkTickRate;
public int SimulationTickRate;
class Baker : Baker<NetConfigAuthoring>
{
public override void Bake(NetConfigAuthoring authoring)
{
var entity = GetEntity(TransformUsageFlags.Dynamic);
var clientServerTickRate = new ClientServerTickRate(){NetworkTickRate = authoring.NetworkTickRate,
SimulationTickRate = authoring.SimulationTickRate};
clientServerTickRate.ResolveDefaults();
AddComponent(entity, clientServerTickRate);
}
}
}

3 changes: 3 additions & 0 deletions Assets/Scripts/Networking/NetConfigAuthoring.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5445f43

Please sign in to comment.