- 【3Dゲームエンジン】Unity質問スレッド15 [転載禁止]©2ch.net
281 :名前は開発中のものです。[sage]:2015/02/02(月) 14:18:32.56 ID:uLgNzaWx - >>277
public YourDontDestroyObject : MonoBehavior { public PlayBGM(int scene) { // bra bra bra } } // some new scene detection script void Start() { GameObject go = Find("/OurDontDestroyObjectName"); if(go == nil) { // may be first scene } else { // YourDontDestroyObject bgmController = go.GetComponent<YourDontDestroyObject>(); bgmController.PlayBGM(SCENE_INDEX); } }
|