Doubt about weaved properties

Options

I noticed that the summary in Networked attribute says to "not use autoproperties (get; set;) in INetworkStructs" and to do "get => default; set {}" instead. But looking at the Health script in Fusion Projectiles I noticed the Hit INetworkStruct uses autoproperties:

To see if it made any difference I looked at the weaved code through ILSpy and the only difference I noticed was the "readonly get" that is only present when autoproperties are used.

So, does this really change anything? Unless readonly getters are managed (which I'm not sure about). Also sorry if this was asked before.

Best Answer

  • nothyper_
    nothyper_
    edited February 2023 Answer ✓
    Options

    Alright, after reading the INetworkStruct docs a lot of things got clearer. So basically:

    Blittable float-types, like Vector3, can use just autoproperties along with Networked attribute for compression. Non-blittable types like bool and string should use the empty getter/setter instead along with Networked attribute or just replaced with NetworkBool and NetworkString. I'll consider this as closed.

Answers

  • nothyper_
    nothyper_
    edited February 2023 Answer ✓
    Options

    Alright, after reading the INetworkStruct docs a lot of things got clearer. So basically:

    Blittable float-types, like Vector3, can use just autoproperties along with Networked attribute for compression. Non-blittable types like bool and string should use the empty getter/setter instead along with Networked attribute or just replaced with NetworkBool and NetworkString. I'll consider this as closed.