Help with + icon next to script in Unity inspector

Hey all. I was trying to access a public enum from one of the scripts for my game. However, it wasn’t accessible from within this one particular class, for some reason.

I looked at the inspector and said script doesn’t have a checkbox for enabling/disabling the component. It also has a + under the c# icon. Can anyone explain what I’m missing here, please?

Here’s a screenshot:

5284386--529839--ammoscript.png

@Clydey2Times

I have no idea about your enum not working part, and I’ll answer your question based on post heading…

“Help with + icon next to script in Unity inspector”

The “+” sign means your object in this picture is a prefab instance, and you have added a Ammo script/component to it in scene, and the prefab doesn’t have it.

So it tells you that this is a difference compared to prefab.

You can see the differences from GameObjects’s inspector upper right corner where is says “Overrides”

3 Likes

Regarding the enum. Have you made both the enum states public and the enum variable?
Also, is your enum variable using a {get; set;}? As these don’t work with unity’s inspector.

I checked the prefab, and it appears to have the Ammo component. They both seem to have it. Maybe I’m missing something obvious?

Edit: I can see the + is gone. Why can’t I disable the component, though? Is it because other scripts reference it, perhaps?

5284710--529902--prefabplayer.jpg

5284710--529905--playersceneammo.jpg

I’m not sure what the problem was with the enum. After the second time I restarted Unity and visual studio, the enum was suddenly accessible. So yeah, I’m at a loss. Might have been a bug.