0
\$\begingroup\$

When attempting to edit an Input Field object's script like so

enter image description here

I get the following error:

Unable to open C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll: Check external application preferences.

Why is Unity attempting to open a *.dll, here?

\$\endgroup\$
2
\$\begingroup\$

The component script you are trying to open is built into that DLL file (i.e. part of that dll). To open the dll file you can use .net decompiler like ILSpy or dotPeek.

Alternatively, you can find the component code at InputField.cs, as part of the Unity-Technologies repo, available under the MIT license.

\$\endgroup\$
2
\$\begingroup\$

Input Field is a class that belongs to the UnityEngine.UI namespace. Unity is attempting to open a *.dll because you are telling it that you would like to edit a class that belongs to that *.dll file. We can see this from the documentation; InputField is listed under UnityEngine.UI.InputField.

You generally wouldn't actually edit the base code for this component, any more than you would edit the base code for a Transform or a Rigidbody. The ability to do so has possibly just been left in due to the way they implemented the component class, though that is just speculation. Ultimately, you wouldn't touch it, directly.

\$\endgroup\$
  • \$\begingroup\$ Since one shouldn't edit this file, could you comment in your answer, on how one would go about "inheriting" (in quotation marks, because perhaps this inheritance is done indirectly) from input field, if one wants to make a more complicated version of it/add additional logic to it? \$\endgroup\$ – user89 May 30 '17 at 18:15
  • \$\begingroup\$ @user89, I would rather not, as it goes outside of the scope of the question you ask, and would detract from the question for future users. If you do not know how to inherit, feel free to ask as an additional question, but beaware that it is a fairly simple concept to look up, and would be prone to judgement for lack of research. In simple terms, make a class with : InputField, just like how you would for a script that inherits from MonoBehaviour. I'm also confused as to why you accepted this answer; you said the other was more helpful. As such, you should accept that answer, instead. \$\endgroup\$ – Gnemlock May 31 '17 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.