Files
MobileCameraShare/Assets/Scripts/ShatterSe.cs
HIRO_MAC 1911637020 Add mobile camera capture, polaroid preview, gallery save & native share
- カメラ撮影 → プレビュー(ポラロイド風白縁)→ 保存 / ネイティブ共有
- iOS / Android のネイティブ実装(共有・ギャラリー保存・FileProvider)
- iOS は共有シートのプリウォームで初回表示を軽減
- iOS Info.plist 用途説明をビルド後処理で自動付与
- Android パッケージ名ガードを有効化(ビルド前チェック)
- README を整備、.gitignore に slnx / .vscode / .utmp を追加

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 12:56:15 +09:00

33 lines
863 B
C#

using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(AudioSource))]
public class ShatterSe : MonoBehaviour
{
private AudioSource audioSource;
void Awake()
{
// 自分にくっついている AudioSource を取得。なければ追加する
audioSource = GetComponent<AudioSource>();
if (audioSource == null)
{
audioSource = gameObject.AddComponent<AudioSource>();
}
// 自分にくっついている Button の OnClick に自動登録する
Button button = GetComponent<Button>();
if (button == null)
{
Debug.LogError("ShatterSe: Button コンポーネントが見つかりません。", this);
return;
}
button.onClick.AddListener(Play);
}
public void Play()
{
audioSource.Play();
}
}