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 Stucko_Stuck · Dec 20, 2010 at 02:16 PM · variableinspector

Why aren't some variables appearing in the Inspector?

I just added a public variable with the type String to a script. However the variable is not appearing in the Inspector. The same goes for other types such as boolean,float,int. Is this a bug or am I doing something wrong?

This is a javascript script

var quitButton: boolean = false;
var normalTexture : Texture2D;
var rollOverTexture : Texture2D;
var levelToLoad : String;
var beep : AudioClip;

I have actually found that the boolean and String will be visible and assignable once I have attached it to an object. I guess the question is solved but I would like to know why the Texture and Audioclip can be assigned even when the script is not attached to any object?

Comment
Add comment · Show 6
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 Christopher K. · Dec 20, 2010 at 02:35 PM 0
Share

You've probably already done this, but selecting another element in the inspector and then the script that has been edited will generally refresh it.

Other than that, how are the variables being declared? This could possibly be the cause.

avatar image Mickydtron · Dec 20, 2010 at 02:50 PM 0
Share

Please attach sample code so that we can see if you are doing anything wrong. With just a symptom description, there really is nothing we can do to diagnose it.

avatar image Jesus_Freak · Dec 20, 2010 at 03:30 PM 0
Share

and you also probably know this, but static vars and private vars can't be edited in the inspector, as far as i know.

avatar image Peter G · Dec 20, 2010 at 03:42 PM 0
Share

nor can properties or readonly variables (not sure why you would want to display them anyway :) )

avatar image Stucko_Stuck · Dec 28, 2010 at 01:13 AM 0
Share

Will post the sample code once I get back home, owh n thanks for the comments;

Show more comments

1 Reply

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

Answer by Mike 3 · Jan 01, 2011 at 09:38 AM

To answer your edit - you can edit the default values in the script for string and boolean, but you can't do the same for audio clip, textures and the like, so unity provides a way to set up default references which will be set when you add the script to a gameobject, just as the default values in the script will be set for booleans and strings

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

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

No one has followed this question yet.

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Hide public field on base class but show it on derived class 1 Answer

Variable in Inspector 1 Answer

how to give title for group of variables? 1 Answer

Select colour then change texture 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