AudioClip not showing up in inspector CSHARP
using UnityEngine;
using System.Collections;
public class player_controller : MonoBehaviour {
AudioClip sound;
}
The above is a simplified version of my code. (by that I mean I cut everything else out) The problem that i'm having is that when I go back into the inspector (after saving in monodevelop) there ISNT this:
Im talking about the part that says sound and has the box you can drag audio into. Mine doesn't have that. I think that I am doing something obviously wrong but I just cant see it. Thanks in advance for any help I get.
Answer by Jessespike · Nov 23, 2015 at 07:50 PM
Inspector only shows fields for variables that can be serialized. Public variables are serialized by default.
public AudioClip sound;
You can also expose private variables with the SerializeField attribute.
[SerializeField]
private AudioClip sound;
If you do not specify public or private, then the member is private by default in classes.
Thanks, for some reason I thought that it would be public by default.
In Unityscript (called "Javascript") the default is public. $$anonymous$$aybe you read a Unityscript tutorial once. :)
Your answer

Follow this Question
Related Questions
Newbie with OnTriggerEnter & Audio Files 0 Answers
Audio or Music continuing to play between scenes 1 Answer
Can't play shoot sound 0 Answers
Audio not playing when destroying a GameObject. 1 Answer
Troubleshooting Footstep Audio 0 Answers