Netcode tutorial is missing these 2:
[CreateBefore(typeof(Unity.NetCode.TransformDefaultVariantSystem))]
public partial class DefaultVariantSystem : DefaultVariantSystemBase
{
protected override void RegisterDefaultVariants(Dictionary<ComponentType, Rule> defaultVariants)
{
defaultVariants.Add(typeof(LocalTransform), Rule.ForAll(typeof(DontSerializeVariant)));
defaultVariants.Add(typeof(KinematicCharacterBody),
Rule.ForAll(typeof(KinematicCharacterBody_GhostVariant)));
}
}
[GhostComponentVariation(typeof(KinematicCharacterBody))]
[GhostComponent(SendTypeOptimization = GhostSendType.OnlyPredictedClients)]
public struct KinematicCharacterBody_GhostVariant
{
[GhostField(Quantization = 1000)] public float3 RelativeVelocity;
[GhostField()] public bool IsGrounded;
}
Took me days to figure out why my jumps were jittery, these 2 lines of code from the online fps sample solved it for me
Netcode tutorial is missing these 2:
[CreateBefore(typeof(Unity.NetCode.TransformDefaultVariantSystem))]
public partial class DefaultVariantSystem : DefaultVariantSystemBase
{
protected override void RegisterDefaultVariants(Dictionary<ComponentType, Rule> defaultVariants)
{
defaultVariants.Add(typeof(LocalTransform), Rule.ForAll(typeof(DontSerializeVariant)));
defaultVariants.Add(typeof(KinematicCharacterBody),
Rule.ForAll(typeof(KinematicCharacterBody_GhostVariant)));
}
}
[GhostComponentVariation(typeof(KinematicCharacterBody))]
[GhostComponent(SendTypeOptimization = GhostSendType.OnlyPredictedClients)]
public struct KinematicCharacterBody_GhostVariant
{
[GhostField(Quantization = 1000)] public float3 RelativeVelocity;
[GhostField()] public bool IsGrounded;
}
Took me days to figure out why my jumps were jittery, these 2 lines of code from the online fps sample solved it for me