Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

New Private field method access issue [Workaround]

Đang mở
#121 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, unity
Lĩnh vực
devtools, game-dev

Hướng nghiên cứu

Bắt đầu với NewFieldsRewriter và tái hiện trường hợp truy cập private field đã được báo cáo trong workflow hot-reload của Unity. So sánh việc truy cập trực tiếp vào _instanceNewField với cách khắc phục bằng biến cục bộ, sau đó xác minh rằng các cách sử dụng như Gizmos.DrawWireSphere(_lastCamState.FinalPosition, BodyRadius) được viết lại nhất quán mà không cần dọn dẹp cú pháp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

workaround

Current Workaround

So it seems this is the workaround for now. Any direct access the new field breaks the rewritter.

_instanceNewField.DoesWhatYouWant(); //<- fails to rewrite
var myLocalNewField = _instanceNewField; // <- this gets correctly rewritten
myLocalNewField.DoesWhatYouWant(); //<- All good

Then on your next recompilation round you can clean up the syntax.

Issue

I'm not sure if it's a regression and what would be its reason, but most of the time nowadays adding private fields fails as they are not rewritten correctly in every places. Example bellow.
Added
private CameraState _lastCamState;

One of the correctly rewritten part I believe
FastScriptReload.Scripts.Runtime.TemporaryNewFieldValues.ResolvePatchedObject<Indus.Client.Cameras.CinemachineBodyCollider__Patched_>(this)._lastCamState = state;

Some other places not rewritten
Gizmos.DrawWireSphere(_lastCamState.FinalPosition, BodyRadius);

It is the NewFieldsRewriter job to perform the rewrite now not sure why it skip some cases.

Ngôn ngữ chính
C#
Star
2.2k
Fork
168
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của handzlikchris/FastScriptReload

Tất cả issue của handzlikchris/FastScriptReload

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.