private void OnEnable() { player1Vibrator = Player1.GetComponent <PlayerVibrator>(); Assert.IsNotNull(player1Vibrator, "PlayerVibrator1 was not found."); player2Vibrator = Player2.GetComponent <PlayerVibrator>(); Assert.IsNotNull(player2Vibrator, "PlayerVibrator2 was not found."); player3Vibrator = Player3.GetComponent <PlayerVibrator>(); Assert.IsNotNull(player3Vibrator, "PlayerVibrator3 was not found."); player4Vibrator = Player4.GetComponent <PlayerVibrator>(); Assert.IsNotNull(player4Vibrator, "PlayerVibrator4 was not found."); }
// Use this for initialization protected virtual void Start() { if (_playerVibrator == null) { _playerVibrator = GetComponent <PlayerVibrator>(); } if (_playerVibrator == null) { Debug.LogWarning("No vibrator found, where is my vibrator? :("); } if (_componentToListen == null) { _componentToListen = GetComponent <T>(); } if (_componentToListen == null) { Debug.LogWarning("No component Found"); } }