I'm trying to convert a javascript file to a C# script for Unity, mostly because the rest of my workflow is in C#, and I'm much more comfortable with C#. In this case, it's an audio controller script.
The .js looks like this:
var audioClips : AudioClips[]; // Array of single use audio clips
var audioLoops : AudioClips[]; // Array of loops
class AudioClips{
var name : String;
var audioClips : AudioClip[];
var volume : float = 1.0;
var volumeBySpeed : boolean = false;
var minVolume : float = 0.2;
var pitchBySpeed : boolean = false;
var minPitch : float = 1.0;
var maxPitch : float = 1.0;
}
and the editor looks like this:
My C# script looks like this:
public class AudioClips : MonoBehaviour
{
public string _name;
public AudioClip[] audioClips;
public float volume = 1.0f;
public bool volumeBySpeed = false;
public float minVolume = 0.2f;
public bool pitchBySpeed = false;
public float minPitch = 1.0f;
public float maxPitch = 1.0f;
}
public class AudioController_SFB_C : MonoBehaviour {
public AudioClips[] audioClipsArray; // Array of single use audio clips
public AudioClips[] audioLoopsArray; // Array of loops
and the editor looks like this:
The C# code doesn't reflect all of the public variables. Interestingly, even if I comment out the public AudioClip[]
section and the code that relies on it, my inspector looks the same. I'm thinking maybe there a scoping issue or a strong-typing issue that I'm missing, but I can't seem to see it.