Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

Build error when compiling using IL2CPP for Android if project uses static NetworkVariables

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

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

priority:medium stat:imported type:docs
Ngôn ngữ chính
C#
Star
2.3k
Fork
461
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
20

Mô tả

Description

Build error when compiling using IL2CPP for Android if project uses static NetworkVariables. This behaviour happens when attempting to build using IL2CPP scripting backend and building to Android. Building to Android using Mono builds successfully with no errors, leading me to believe this is a bug/unintended.

Reproduce Steps
  • Declare a static NetworkVariable in a NetworkBehaviour script. (public static NetworkVariable<int> in my case)
  • Set scripting backend to IL2CPP
  • Set build platform to Android
  • Build
  • Error displayed as shown in Additional Context section
Actual Outcome

Build fails with two error messages in console.

Expected Outcome

Build should compile successfully with no errors.

Screenshots

Error in Console:
image

Environment
  • OS: [Windows 10]
  • Unity Version: [2022.3.9f1]
  • Netcode Version: [1.5.2]
  • Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]
Additional Context

Full Error Logs:

Building Library\Bee\artifacts\Android\iz17e\25857ix1c827.o failed with output:
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5692,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_0 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5708,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_3 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5711,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_4 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5714,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_6 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5717,78): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_7 = __this->___OtherClientPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5733,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_10 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5736,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_11 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5739,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_13 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
8 errors generated.

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Building Library\Bee\artifacts\Android\d8kzr\25857ix1c827.o failed with output:
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5692,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_0 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5708,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_3 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5711,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_4 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5714,78): error: no member named '___HostPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_6 = __this->___HostPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5717,78): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_7 = __this->___OtherClientPlayerHealth;
                                                                                   ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5733,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_10 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5736,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_11 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
L:\Career\Development\Unity\GitHub\PrototypeCRF\Library\Bee\artifacts\Android\il2cppOutput\cpp\Assembly-CSharp.cpp(5739,79): error: no member named '___OtherClientPlayerHealth' in 'HubManager_t257E0CCDF9E261EA4899F86EEF4B1C6AAEEF8922'
                NetworkVariable_1_t72006E2365F7131BBF61213343C271666361F504* L_13 = __this->___OtherClientPlayerHealth;
                                                                                    ~~~~~~  ^
8 errors generated.

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu với việc tái hiện NetworkVariable static đã được báo cáo trong một NetworkBehaviour, sau đó build project cho Android bằng IL2CPP và Mono để so sánh kết quả. Theo dõi output IL2CPP được tạo ra và các member bị thiếu đã được báo cáo; hoàn tất khi build IL2CPP cho Android hoàn thành mà không có lỗi.

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

Đánh giá

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

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.