Skip to content

Avoid using property getters and setters when deserializing #11

Description

@Warpten

This is not a pretty solution but it would help avoiding the issue of value type getters returning temporary copies of the underlying types. The problem is that autogenerated getters typically retrieve a field named <prop>k_BackingField, (IsSpecialName returns true) which is compiler-specific. So not exactly portable.

The idea is to not limit the user to reference type substructures:

    public class C3Vector // Runtime exception if value type.
    {
        public float X { get; set; }
        public float Y { get; set; }
        public float Z { get; set; }
    }

    public struct AreaTriggerEntry
    {
        public uint ID { get; set; }
        public uint MapID { get; set; }
        public C3Vector Position { get; set; }
        public float Radius { get; set; }
        public C3Vector BoxSize { get; set; }
        public float BoxOrientation { get; set; }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions