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 navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
No one has followed this question yet.
Saving values generated in game to use in prefabs.
How to access gameobject array set in inspector?
[solved] How to edit an array of custom classes in the Inspector
GUI, Inspector has no control for Arrays?
Array of transforms with "labels"