/* * Main instrument prefab * Grabbable instrument with clips and parameter buttons/sliders */ public static InstrumentAttachment CreateInstrument(BaseInstrument instrument) { //Create an instrument prefab GameObject instrumentGame = Instantiate(Instance.instrumentPrefab) as GameObject; instrumentGame.name = instrument.Name; //Create instrument attachment InstrumentAttachment attach = instrumentGame.AddComponent <InstrumentAttachment>(); //Instrument attachment needs to be manually added //Init instrumentRef and GUI controls attach.Init(instrument); attach.InitInstrumentControls(); //Set listener prefixes instrumentGame.renderer.materials[1].SetColor("_Color", instrument.color); return(attach); }