Jump to content

Trouble Shooting Thread


Recommended Posts

or, a collection of errors and their (potential) solutions.

the basic idea is to have a collection of errors during modding that are not common; log the error messages and their solutions, so present and future modders can potentially find a solution quickly.

Caveat being the dreaded NullReferenceException error where the exact error message may or may not be helpful and the context of the situation is more important. In those cases, please provide as much information as possible.

if adding to the thread, please include exact error message from output_log.txt or Unity Console, explanation of the cause, and solution, with Unity screenshots where possible. follow the format of the examples below. Please only add issues that you can replicate and resolve consistently.


Problem:

File error: 
at (wrapper managed-to-native) UnityEngine.Mesh:get_vertexCount ()
at KSPPartTools.PartWriter.WriteMesh (System.IO.BinaryWriter bw, UnityEngine.Mesh mesh) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteCollider (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0

found in Unity Console, CTRL-SHIFT-C

Explanation:

Occurs during export, prevents MU from being created, or a corrupted MU, no textures exported. Typically caused by missing mesh assignment in mesh filter component or mesh collider component.

Solution:

Assign mesh in Unity where missing

aPh1bQi.jpg


Problem:

File error: 
at (wrapper managed-to-native) UnityEngine.Object:get_name ()
at KSPPartTools.PartWriter.WriteAnimation (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0

found in Unity Console, CTRL-SHIFT-C

Explanation:

occurs during Export; no MU is created; no textures created. caused by missing animation clip assignment or extra animation clip slot.

Solution:

assign necessary animation clip in each slot; or reduce Size to match # of animation clips. if duplicate entries exist, may need to manually set a duplicate slot to None before able to reduce the Size fie

tVsN1o0.jpg


Problem:

File error:
Out of memory
at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
at A..ReadAnimation (System.IO.BinaryReader br, UnityEngine.GameObject o) [0x00000] in <filename unknown>:0
at A..ReadChild (System.IO.BinaryReader br, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at A..ReadChild (System.IO.BinaryReader br, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at A..ReadChild (System.IO.BinaryReader br, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at A.. (.UrlFile ) [0x00000] in <filename unknown>:0
(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

found in KSP_Data/output_log.txt

Explanation:

No errors during export. Error occurs during game loading, prevents part from compiling and loading into game database; possibly preventing subsequent parts from being loaded into the game. Caused by unexpected animation curves that KSP loader can not read. On rare occasions it can be a corrupted animation curve that was intended, in which case the animation clip should be recreated in Unity before exporting the MU.

Solution:

check animation clip for unwanted animation curves on properties like "Play Automatically"; Component's On/Off property. Generally any property that is not Transform; Emissive Color/Alpha; Light Color/Intensity/Range, should not have animation curve.

Q1hUrXD.jpg


Problem:

Material doesn't have a texture property '_MainTex'
UnityEngine.Material:GetTextureScale(String)
KSPPartTools.PartWriter:WriteMaterialTexture(BinaryWriter, Material, String, TextureType)
KSPPartTools.PartWriter:WriteMaterial(BinaryWriter, Material)
KSPPartTools.PartWriter:Write(String, String, Transform, TextureFormat)
KSPPartTools.PartToolsInspector:DrawWriterGUI()
KSPPartTools.PartToolsInspector:OnInspectorGUI()
PartToolsEditor:OnInspectorGUI() (at Assets/Editor/PartToolsEditor.cs:18)
UnityEditor.DockArea:OnGUI()

found in Unity Console; CTRL-SHIFT-C

Explanation:

Occurs during part export. caused by missing shader assignment on a unity material.

Solution:

assign appropriate shader on the material

oDyPG5D.jpg


Problem:

PartLoader: Compiling Part 'RetroFuture/Command/med2mPodA/med2mPodA/med2mPodA'
(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object
at PartLoader.ReplaceTextures (UnityEngine.GameObject model, System.Collections.Generic.List`1 textureNames, System.Collections.Generic.List`1 newTextures) [0x00000] in <filename unknown>:0
at PartLoader.CompileModel (.UrlConfig cfg, .ConfigNode partCfg, Single scaleFactor) [0x00000] in <filename unknown>:0
at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0
at PartLoader+.MoveNext () [0x00000] in <filename unknown>:0
(Filename: Line: -1)

found in KSP_Data/output_log.txt

Explanation:

a texture related NullRef error that can be caused by few different things. clue typically provided by PartLoader: line just before the error message, it points to the MU that cannot find necessary texture.

1. missing texture in a shader's texture channel (see screen shot below)

2. missing, typo, incorrect syntax in MODEL{} texture assignment

3. missing dummy texture in Part folder

4. missing target texture, either in Part folder, or some other location if referencing existing textures.

Solution:

1. assign textures to the shader where missing

vYxu3Be.jpg

2. check config file MODEL{} and make sure all textures required by the MU file is listed, and full path to target texture is correct. check for syntax errors. check each opening bracket has associated closing bracket. target textures that reside in same folder as MU file typically do not cause this error.

MODEL
{

[INDENT]model = MyMod/Part/part //full path to part folder with MU file name. without ".mu" extension
[COLOR="#FF0000"][B]textrue[/B][/COLOR] = texture1, MyMod/Textures/texture1 //texture names must match exactly
texture = [COLOR="#FF0000"][B]textre2[/B][/COLOR], SomeOtherMod/Part/texture2
etc[/INDENT]


}

3 and 4. make sure referenced texture and target textures exist at expected locations and file names match with what is in MODEL{}


Problem:

File error:
Failed to read past end of stream.
at System.IO.BinaryReader.ReadByte () [0x00000] in <filename unknown>:0
at System.IO.BinaryReader.Read7BitEncodedInt () [0x00000] in <filename unknown>:0
at System.IO.BinaryReader.ReadString () [0x00000] in <filename unknown>:0
at A..ReadTextures (System.IO.BinaryReader br, UnityEngine.GameObject o) [0x00000] in <filename unknown>:0
at A..ReadChild (System.IO.BinaryReader br, UnityEngine.Transform parent) [0x00000] in <filename unknown>:0
at A.. (.UrlFile ) [0x00000] in <filename unknown>:0
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

part generates following error in Unity during Export

File error: Cannot cast from source type to destination type.  at KSPPartTools.BitmapWriter.Write2D (UnityEngine.Texture texture, System.String newPath, TextureType texType) [0x00000] in <filename unknown>:0 
at KSPPartTools.PartWriter.WriteTexture (UnityEngine.Texture texture, System.String path, System.String filePath, KSPPartTools.TextureDummy tex, System.String filename) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.WriteTextures (System.IO.BinaryWriter bw) [0x00000] in <filename unknown>:0
at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0


UnityEngine.Debug:LogError(Object)
KSPPartTools.PartWriter:Write(String, String, Transform, TextureFormat)
KSPPartTools.PartToolsInspector:DrawWriterGUI()
KSPPartTools.PartToolsInspector:OnInspectorGUI()
PartToolsEditor:OnInspectorGUI() (at C:/Users/Ven/Documents/KsPMAKE/Assets/PartTools/Editor/PartToolsEditor.cs:18)
UnityEditor.DockArea:OnGUI()

Explanation:

Similar to earlier error message related to Animation. MU file was exported incorrectly due to texture related issue in Unity.

Solution

Check part's materials in Unity for incorrect source texture format, like assigning a DDS texture to the part in Unity.


Problem:

NullReferenceException: Object reference not set to an instance of an object
at InternalButtonLight.OnAwake () [0x00000] in <filename unknown>:0
at InternalModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at InternalProp.AddModule (.ConfigNode node) [0x00000] in <filename unknown>:0
at InternalProp.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at PartLoader.LoadInternalProp (.UrlConfig urlConf) [0x00000] in <filename unknown>:0
at PartLoader+.MoveNext () [0x00000] in <filename unknown>:0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
:MoveNext()
(Filename: Line: -1)

Something related to PartModules, start with Config file Module blocks, and ModuleManager changes, make sure PartModules are referencing correct GameObject in the MU.

Edited by nli2work
Link to comment
Share on other sites

  • 1 year later...

any idea how to fix this one?

File error: Object reference not set to an instance of an object
  at KSPPartTools.PartWriter.WriteMesh (System.IO.BinaryWriter bw, UnityEngine.Mesh mesh) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteMeshFiler (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0 

UnityEngine.Debug:LogError(Object)
KSPPartTools.PartWriter:Write(String, String, Transform, TextureFormat)
KSPPartTools.PartToolsInspector:DrawWriterGUI()
KSPPartTools.PartToolsInspector:OnInspectorGUI()
PartToolsEditor:OnInspectorGUI() (at Assets/PartTools/Update 0.23/Editor/PartToolsEditor.cs:18)
UnityEditor.DockArea:OnGUI()

occurs when attempting to write

Link to comment
Share on other sites

20 hours ago, amankd said:

any idea how to fix this one?

occurs when attempting to write

I recall encountering it before. Have you tried the usual steps to fix? ie restart Unity, re-export your models, etc. 

If I remember.... I think it gave me this error if I had files in my project that were not downloaded to my PC (I work off a cloud based folder so I can easily switch PCs) so the files would show up by Unity would get upset when it tried to index everything for export. Mind you these weren't files I was working with at the time, but rather files in other folders of the Unity project.

Link to comment
Share on other sites

23 hours ago, amankd said:

any idea how to fix this one?


File error: Object reference not set to an instance of an object
  at KSPPartTools.PartWriter.WriteMesh (System.IO.BinaryWriter bw, UnityEngine.Mesh mesh) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteMeshFiler (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.WriteChild (System.IO.BinaryWriter bw, UnityEngine.Transform t) [0x00000] in <filename unknown>:0 
  at KSPPartTools.PartWriter.Write (System.String modelName, System.String filePath, UnityEngine.Transform target, TextureFormat textureFormat) [0x00000] in <filename unknown>:0 

UnityEngine.Debug:LogError(Object)
KSPPartTools.PartWriter:Write(String, String, Transform, TextureFormat)
KSPPartTools.PartToolsInspector:DrawWriterGUI()
KSPPartTools.PartToolsInspector:OnInspectorGUI()
PartToolsEditor:OnInspectorGUI() (at Assets/PartTools/Update 0.23/Editor/PartToolsEditor.cs:18)
UnityEditor.DockArea:OnGUI()

occurs when attempting to write

Most likely one of the mesh filter components is missing target mesh object.

Edited by nli2work
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...