Jump to content

NullReferenceException error after adding flagTransform


Recommended Posts

I have the working pod without a flagTransform. If I add flagTransform to the export, I get a "NullReferenceException: Object reference not set to an instance of an object" when the game attempts to compile the model, which I'm pretty sure is causing the game to delete every stock part from the database. only ones remaining are from Nasa mission.

nothing in the log files or debug log besides the NullReferenceException error.

Any ideas? any thing I can do or use to get a more detailed version of the error?

Link to comment
Share on other sites

I haven't made many models for KSP since programming is my specialty, but a nullreferenceexception arises when a script tries to access a nonexistent component. I'm guessing in this case the FlagTransform needs a mesh filter and mesh renderer (added through Unity's component menu). Try adding those and see what happens.

Unfortunately NREs are very generic and there is next to no specification as to what caused them besides a line number in the script that caused the error. Fortunately my experience with Unity and the apparent behavior of the FlagTransforms in game narrow it down to one specific issue: a missing component that the script is still trying to access and change, hence the null reference. You can't change something that isn't there after all.

:P
Edited by OrbitusII
Link to comment
Share on other sites

I haven't made many models for KSP since programming is my specialty, but a nullreferenceexception arises when a script tries to access a nonexistent component. I'm guessing in this case the FlagTransform needs a mesh filter and mesh renderer (added through Unity's component menu). Try adding those and see what happens.

yeah already checked that. all mesh objects have mesh filter and renderer components; all collider objects have collision mesh assigned.

Link to comment
Share on other sites

yeah already checked that. all mesh objects have mesh filter and renderer components; all collider objects have collision mesh assigned.

Ok then, the names in Unity and the config file match exactly? As I'm sure you know, Unity is case sensitive.

Link to comment
Share on other sites

Yeah triple checked that as well. names, cases, file paths, all match up. Removing the FlagDecal module from config doesn't make any difference. I don't know what it is. empty transform called flagTransform works fine. as soon as I add mesh filter and mesh renderer, the exported file throws the error. doesn't matter if it's imported mesh or primitive created in Unity. I'll just leave it out. :/ At least it's not affecting flagTransform on other exports.

Edited by nli2work
Link to comment
Share on other sites

hi !

Is you're mesh model have a correct scale applied, and uv texture !

it's certainly not the problem but sometime mesh who have a bad scale do weird thing in export !

@+

just went back and checked scales. also closed all open meshe objects. still no cigar. :/

Link to comment
Share on other sites

hi !

I have checked my little test box (two flag on two mobile part), and ok :

you need mesh Filter + mesh renderer + a ksp texture type : KSP/alpha/cutoff

and nothing else !!

in cfg part : ex my box

MODULE

{

name = FlagDecal

textureQuadName = PlaneFL1 <- It's a name of the mesh object support the texture !

}

that all don't assign texture to this mesh flag ...

Ksp put the flag himself to the support .

(I pretty sure it's not the problem..,but if you want check the French section the model of my

box come as tutorial and it's released with the blender file + the unity project )

@+

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...