- Home /
Viewing Class variables in inspector?
Im not sure how to word this question so this is what i want...lol
in the inspector i want to be able to click the 'Audio' parameter and display the audio varibles in a drop down environment in the inspector.
Example (Inspector view):
*Audio
(Click Audio parameter) - Shows
Music
SFX
Background Noise
List item
(Click SFX)
(SFX parameters here)
Im using c# for the code
Thanks.
Answer by Triqy · Jan 19, 2014 at 12:42 AM
Nevermind... this is the Answer. lol Every time i ask a question I solve it 10 Seconds later on my own.
public class PlayerScript : MonoBehaviour {
public List<AudioClass> Audio;
//Audio
[System.Serializable]
public class AudioClass{
public AudioClip[] SFX;
public AudioClip[] Music;
public AudioClip[] BackgroundNoise;
}
}
Well... maybe next time you do those 10 seconds of researching before you post a question. Even most of the stuff you didn't answer yourself could have been googled or learned by going through the Learning $$anonymous$$odules
I've been searching for it for hours...I then give up and ask a question and then 10 seconds later figure it out. It was simply an ironic view then something to take seriously. Here is another version on it without using the Lists parameter.
public class PlayerScript : $$anonymous$$onoBehaviour {
//Audio
[System.Serializable]
public class AudioClass{
public string Name = Audio;
public AudioClip[] SFX;
public AudioClip[] $$anonymous$$usic;
public AudioClip[] BackgroundNoise;
public bool ButtonClickSound = false;
public bool BackClickSound = false;
}
public AudioClass[] Audio;
}
You don't get what I mean. UA is swamped by trivial questions and code write requests by people who simply install Unity, click around for five $$anonymous$$utes and the go to ask their first question about how to implement their game.
Spending some time actually going through the learning material that is provided should be common courtesy, as should be to google or search your question here before asking it. Searching with your title on this site gives you multiple results answering your question on the first page.
Ive been a remember on UA since 2011 and use it daily... and search though it daily.. so i don't think what your saying applies to me..lol thanks for the karma fall man. I appreciate it.
I also think its funny on how you went through my profile and down voted a lot of my answers that people view and answer their own questions. lol seems counter intuitive if you ask me. I guess $$anonymous$$arma has found a way to me through the internet! lol