やりたいこと
・アプリ1、アプリ2を起動
・アプリ1でボタンを押せばアプリ2でもボタンが押される(クリックイベント or bool型変数を変更する)
やってみたこと(ここにUnityのファイルを入れています)
https://drive.google.com/open?id=1aV-1SiB56L3JGVzWqAmqc85PYFNW1268
ボタンのオブジェクトに以下をつけて、クリック
csharp
1 2using System.Collections; 3using System.Collections.Generic; 4using UnityEngine; 5using UnityEngine.Networking; 6 7public class MoviePlay : NetworkBehaviour { 8 [SyncVar] 9 bool IsPlay = false; 10 11 void Update(){ 12 if(IsPlay){ 13 Debug.Log("再生中"); 14 } 15 } 16 17 public void OnClick(){ 18 CmdOnClick(); 19 } 20 [Command] 21 void CmdOnClick(){ 22 IsPlay = true; 23 } 24}
結果:コンソールにDid not find target for sync message for 1と表示され、同期されない
あなたの回答
tips
プレビュー