I am trying to create an array to hold something but it is not appearing in the inspector so I cannot populate it, I could do it with code but for a reason that is unknown to me I cannot simply drag the things I want to populate the array with into it from the hierarchy like I usually can
anything wrong with that that would cause it to not show up in the inspector? MenuItem is the class I want to populate my array with
MenuItem is a custom Attribute-class for editor scripts. I guess that was the problem. http://unity3d.com/support/documentation/ScriptReference/MenuItem.html
Answer by wat
Feb 21, 2011 at 04:17 AM
Nevermind It turns out my prefab for my menu items was named the same as the script and unity apparently hates that.. I had to change the name of my script to lower case letters and then change that line to use
Don't name a variable in PascalCase or a class in camelCase. Pick a name that hasn't already been used. Having a variable be the same name as a class is not good practice. If you want to be able to access an object like an array, you can use indexers, though. http://msdn.microsoft.com/en-us/library/2549tw02.aspx (There is no way to work with these in UnityScript, as far as I know.) Unity's Vector2/3/4 and Color, for example, use indexers.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
C# Array doesn't appear on Inspector
See MonoScript's attributes in the inspector (when it is in an array)
GUI, Inspector has no control for Arrays?
GUIStyle in an inspector array
Custom Inspector Array Elements Not Updating