Created
April 24, 2018 14:56
-
-
Save TyounanMOTI/d9581d1d62d52e65c30540adb2e36a4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AudioPlayer : MonoBehaviour { | |
[SerializedField] | |
private float initialVolume; | |
void Start() { | |
Debug.Log(volume); | |
} | |
} | |
public class AudioEventAsset : ScriptableObject { | |
public float volume; | |
} | |
public class AudioSpawner : MonoBehaviour { | |
public AudioEventAsset[] events; | |
void Start() { | |
foreach (var audioEvent in events) { | |
var player = AddComponent<AudioPlayer>(); | |
player.initialVolume = events.volume; // エラー!privateメンバへアクセス | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment