Errors with UnityEngine.Random.

Hello,
I am trying to publish my game on Cloud Build. It publishes fine locally (under ‘Build & Run’), but I keep on getting errors when I try and publish it on Cloud Build, and it is more likely because of unknown namespaces or functions of namespaces. I don’t understand what the problem exactly is because when I import packages (such as ‘utility’), it should be automatically ‘compatible’ with the Cloud Build, but it isn’t. If I ‘comment out’ the part(S) of the code that causes the errors, or delete the .cs file that COMES with the built-in packages. I get even MORE errors. Here are the kinds of errors I keep on getting in Cloud development. What can be done? Thanks.


: [Unity] Initialize engine version: 5.3.8f1 (9886e74732cf)
2: [Unity] -----CompilerOutput:-stdout–exitcode: 1–compilationhadfailure: True–outfile: Temp/Assembly-CSharp.dll
3: [Unity] Compilation failed: 6 error(s), 9 warnings
4: [Unity] Assets/Scripts/Attach scripts/DoorAttacher.cs(19,28): warning CS0219: The variable child' is assigned but its value is never used 5: [Unity] Assets/Scripts/Attach scripts/DoorAttacher.cs(66,28): warning CS0219: The variable child’ is assigned but its value is never used
6: [Unity] Assets/Scripts/Attach scripts/PanelAttacher.cs(33,28): warning CS0219: The variable child' is assigned but its value is never used 7: [Unity] Assets/Scripts/Attach scripts/PanelAttacher.cs(88,28): warning CS0219: The variable child’ is assigned but its value is never used
8: [Unity] Assets/Scripts/Attach scripts/RoomAttacher.cs(166,28): warning CS0219: The variable child' is assigned but its value is never used 9: [Unity] Assets/Scripts/Attach scripts/RoomAttacher.cs(209,28): warning CS0219: The variable child’ is assigned but its value is never used
10: [Unity] Assets/Scripts/Attach scripts/StairAttacher.cs(28,28): warning CS0219: The variable child' is assigned but its value is never used 11: [Unity] Assets/Scripts/Attach scripts/StairAttacher.cs(75,28): warning CS0219: The variable child’ is assigned but its value is never used
12: [Unity] Assets/Scripts/Attach scripts/WorldAttacher.cs(417,28): warning CS0219: The variable `child’ is assigned but its value is never used

13: [Unity] Assets/Scripts/Bible/Bible.cs(6170,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
14: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
15: [Unity] Assets/Scripts/Bible/Bible.cs(6176,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
16: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
17: [Unity] Assets/Scripts/Bible/Bible.cs(6181,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
18: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
19: [Unity] Assets/Scripts/Bible/Bible.cs(6187,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
20: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
21: [Unity] Assets/Scripts/Bible/Bible.cs(6192,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
22: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
23: [Unity] Assets/Scripts/Bible/Bible.cs(6197,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’

24: [Unity] /UNITY_PATH/Unity/Unity-5_3_8f1/Unity.app/Contents/Managed/UnityEngine.dll (Location of the symbol related to previous error)
25: [Unity] Assets/Scripts/Attach scripts/DoorAttacher.cs(19,28): warning CS0219: The variable child' is assigned but its value is never used 26: [Unity] Assets/Scripts/Attach scripts/DoorAttacher.cs(66,28): warning CS0219: The variable child’ is assigned but its value is never used
27: [Unity] Assets/Scripts/Attach scripts/PanelAttacher.cs(33,28): warning CS0219: The variable child' is assigned but its value is never used 28: [Unity] Assets/Scripts/Attach scripts/PanelAttacher.cs(88,28): warning CS0219: The variable child’ is assigned but its value is never used
29: [Unity] Assets/Scripts/Attach scripts/RoomAttacher.cs(166,28): warning CS0219: The variable child' is assigned but its value is never used 30: [Unity] Assets/Scripts/Attach scripts/RoomAttacher.cs(209,28): warning CS0219: The variable child’ is assigned but its value is never used
31: [Unity] Assets/Scripts/Attach scripts/StairAttacher.cs(28,28): warning CS0219: The variable child' is assigned but its value is never used 32: [Unity] Assets/Scripts/Attach scripts/StairAttacher.cs(75,28): warning CS0219: The variable child’ is assigned but its value is never used
33: [Unity] Assets/Scripts/Attach scripts/WorldAttacher.cs(417,28): warning CS0219: The variable `child’ is assigned but its value is never used

34: [Unity] Exception: The classes in the module cannot be loaded.
35: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
36: [Unity] Assets/Scripts/Bible/Bible.cs(6170,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
37: [Unity] Exception: The classes in the module cannot be loaded.
38: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
39: [Unity] Assets/Scripts/Bible/Bible.cs(6176,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
40: [Unity] Exception: The classes in the module cannot be loaded.
41: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
42: [Unity] Assets/Scripts/Bible/Bible.cs(6181,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
43: [Unity] Exception: The classes in the module cannot be loaded.
44: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
45: [Unity] Assets/Scripts/Bible/Bible.cs(6187,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
46: [Unity] Exception: The classes in the module cannot be loaded.
47: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
48: [Unity] Assets/Scripts/Bible/Bible.cs(6192,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’
49: [Unity] Exception: The classes in the module cannot be loaded.
50: [Unity] API Updater: Exception verifying member: InitStateException: The classes in the module cannot be loaded.
51: [Unity] Assets/Scripts/Bible/Bible.cs(6197,28): error CS0117: UnityEngine.Random' does not contain a definition for InitState’

The first error I see there is in Assets/Scripts/Bible/Bible.cs. UnityEngine.Random' does not contain a definition for InitState’ because the Unity version being used on the cloud is 5.3.8f1 and that function was not available until Unity 5.4. Which version are you using on your local machine? Is there any way to set which version cloud build should use? If possible, those two versions should match.

I didn’t know you could do that, and I don’t know how to.

I saw a bunch of Unity versions in my cloud build page under ‘config’, but noticed that 5.4 is not listed as one of them. I see “always use latest 4.x (Non beta)” Is that referring to Unity 5.4.x?

I changed it to “always use latest 4.x (Non beta)”, got no information on any errors, but here is what I got in the ‘compacted’ section of WHY it failed. I don’t know what to do from there…

: No Library cache found - ALL assets will be re-imported.
2: [Unity] Initialize engine version: 4.7.2f1 (a7fe7b7f3d1f)
3: [Unity] There are inconsistent line endings in the ‘Assets/Scripts/Level adder/LevelAdder.cs’ script. Some are Mac OS X (UNIX) and some are Windows.
4: [Unity] NullReferenceException: Object reference not set to an instance of an object
5: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Sprite’ - Setting to default shader.
6: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Sprite’ - Setting to default shader.
7: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field Overlay’ - Setting to default shader.
8: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field Overlay’ - Setting to default shader.
9: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field (Surface)’ - Setting to default shader.
10: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field (Surface)’ - Setting to default shader.
11: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field Overlay’ - Setting to default shader.
12: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field Overlay’ - Setting to default shader.
13: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field - Masking’ - Setting to default shader.
14: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field - Masking’ - Setting to default shader.
15: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field’ - Setting to default shader.
16: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field’ - Setting to default shader.
17: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field’ - Setting to default shader.
18: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field’ - Setting to default shader.
19: [Unity] Initialize engine version: 4.7.2f1 (a7fe7b7f3d1f)
20: [Unity] TypeLoadException: Could not load type ‘TMPro.TMP_InputField’ from assembly ‘TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
21: [Unity] TypeLoadException: Could not load type ‘TMPro.TMP_SubMeshUI’ from assembly ‘TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
22: [Unity] TypeLoadException: Could not load type ‘TMPro.TextMeshProUGUI’ from assembly ‘TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
23: [Unity] There are inconsistent line endings in the ‘Assets/Scripts/Level adder/LevelAdder.cs’ script. Some are Mac OS X (UNIX) and some are Windows.
24: [Unity] TypeLoadException: Could not load type ‘TMPro.TMP_InputField’ from assembly ‘TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
25: [Unity] NullReferenceException: Object reference not set to an instance of an object
26: [Unity] -----CompilerOutput:-stdout–exitcode: 1–compilationhadfailure: True–outfile: Temp/Assembly-CSharp-firstpass.dll
27: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
28: [Unity] Internal compiler error. See the console log for more information. output was:
29: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
30: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Sprite’ - Setting to default shader.
31: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Sprite’ - Setting to default shader.
32: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Sprite’ - Setting to default shader.
33: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field Overlay’ - Setting to default shader.
34: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field Overlay’ - Setting to default shader.
35: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field Overlay’ - Setting to default shader.
36: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field (Surface)’ - Setting to default shader.
37: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field (Surface)’ - Setting to default shader.
38: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field (Surface)’ - Setting to default shader.
39: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field Overlay’ - Setting to default shader.
40: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field Overlay’ - Setting to default shader.
41: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field Overlay’ - Setting to default shader.
42: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field - Masking’ - Setting to default shader.
43: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field - Masking’ - Setting to default shader.
44: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field - Masking’ - Setting to default shader.
45: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field’ - Setting to default shader.
46: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field’ - Setting to default shader.
47: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Mobile/Distance Field’ - Setting to default shader.
48: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field’ - Setting to default shader.
49: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field’ - Setting to default shader.
50: [Unity] WARNING: Shader Unsupported: ‘TextMeshPro/Distance Field’ - Setting to default shader.
51: [Unity] MissingComponentException: There is no ‘Transform’ attached to the “TextMeshPro - Prefab 2” game object, but a script is trying to access it.
52: ! build of ‘default-web-player’ failed. compile failed
53: publishing finished successfully.
54: Finished: FAILURE

Here are all the errors I was able to catch in the ‘Full log’ after switching everything to “always use latest 4.x (Non beta)” …

54583 [Unity] *** Launching bug reporter due to crashbug - If this project’s Unity Cloud Build configuration is not set for the latest version of Unity, please consider upgrading, as that may resolve this error…
108489: [Unity] -----CompilerOutput:-stdout–exitcode: 1–compilationhadfailure: True–outfile: Temp/Assembly-CSharp-firstpass.dll
108502: [Unity] Internal compiler error. See the console log for more information. output was:
108827: [Unity] *** Launching bug reporter due to crashbug - If this project’s Unity Cloud Build configuration is not set for the latest version of Unity, please consider upgrading, as that may resolve this error…
1
108852: ! build of ‘default-web-player’ failed. compile failed
108858: Finished: FAILURE

… but there are not as many ‘errors’ from Libraries and functions now. How do I prevent crashing?

IF “always use latest 4.x (Non beta)” refers to Unity 5.4.x, then why is it the second item in the drop-down list, and “Always use the latest Unity 5.3” is the first item and is the default selection? If not, where can I download the 5.4 version for cloud development so that it shows up in the list of configurations? Thanks.