- Home /
Inspector cannot find script instance
Hey there, I'm trying to make a game in Unity, as you'd probably guessed, but I'm hitting a somewhat strange bug. I have a C# script, that makes use of an instantiation of a different C# script that I've already written. Naturally, the obvious way to achieve this is to leave the variable public, and select the scripted object from the inspector. This is what I'm trying to do, but for some reason, the object doesn't appear in the inspector at all, so I am unable to select it. There are a couple of possible causes for this that I can think of. The first is that the object I'm trying to select was instantiated, script and all, using a prefab, rather than from building an object from scratch. The second (and more likely) possible reason is that both scripts belong to different C# namespaces. I have the correct using statements, but that doesn't seem to help this. Here are some screenshots so you can see what's happening. I would appreciate some help with this issue.
Answer by numberkruncher · May 26, 2013 at 02:46 PM
Yes components are currently not properly shown within the selection window which is rather annoying. Though you can just drag and drop your "KartPlayer" object from the hierarchy window and drop onto your "Kart" field which will create the connection for you.
Thank you. I'm still getting to grips with some of the finer points of the Unity editor, so hadn't realised this was possible.
Yeah, this is a really neat trick. You might also like to know that you can "lock" the inspector to the selected object using the padlock in the upper right corner. This allows you to have multiple inspectors shown simultaneously which can be handy sometimes.