Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by GutoThomas · May 01, 2012 at 10:40 PM · inspectorinventoryhide

Public variable not appearing in the inspector (C#)

Why isn't this public variable being showed in the inspector?

 public class controleInventario : MonoBehaviour {
     
     [System.Serializable]
     public class Configuracoes {
         
         public int Espacamento;
         public Vector2 posicaoNaTela;
         public int Altura, Largura;
         public int larguraIcone, alturaIcone;
         public int Linhas, Colunas;
         
         [HideInInspector]
         public Rect retanguloFinal;
         
     }
     
     [System.Serializable]
     public class icones {
         
         public Texture2D Nulo = null;
         public Texture2D Machado;
         public Texture2D Espada;
         public Texture2D Amuleto;
         
     }
     
     [System.Serializable]
     public class objetos {
         
         public GameObject Nulo = null;
         public GameObject Machado;
         public GameObject Espada;
         public GameObject Amuleto;
         
     }
     
     public Configuracoes configInventario;
     public icones Icones;
     public objetos Objetos;
     public slot[] Slots; // THIS ONE!
     
     public bool inventarioAberto;
     public KeyCode teclaDeAbertura;

[...]

And here's the slot class:

 public class slot {
 
         public int itemID;
         public Texture2D representacaoGrafica;
         public GameObject objetoReferente;
         public int quantidadeNesteSlot;
         public Rect Posicao;
         public bool emUso;
 
 }


Here's the image that show the variable not being displayed:

alt text

Can someone explain me this? Thanks from now!

Capturar.jpg (13.2 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Comaleaf · May 01, 2012 at 10:48 PM 0
Share

Does it work if you change slot to public class slot : System.ValueType { ? What I can think of is that the editor might not serialise a class unless it is a struct (`System.ValueType`). Just a theory though.

avatar image GutoThomas · May 01, 2012 at 10:54 PM 0
Share

It gave me an error saying that slot can not derive from Special Class System.ValueType. When I tried to create an public array of type 'icones' it works and it appear in the inspector. The problem seems to be just with 'slot' class.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by GutoThomas · May 01, 2012 at 10:56 PM

Sorry everyone!

That was a totally newbie part of me because I didn't set slot to a serializableAttribute.

Now it's working. So obvious... Sorry again!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Seth-Bergman · May 01, 2012 at 10:50 PM

try :

public icones Icones = new icones(); etc...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GutoThomas · May 01, 2012 at 10:54 PM 0
Share

It doesn't work. =(

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I retrieve an item from a list? 1 Answer

Hide from inspector interface but not from the debug inspector? 4 Answers

Making a minor change to Default inspector? 1 Answer

Are inspector values supposed to override [HideInInspector] code? 1 Answer

Script only working on one child? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges