//tips
//微調整
MycamornotスクリプトとHPUICameraLookat スクリプトの各所にデバッグを挿入するも問題なさそう。
transform.LookAt(lookpos);がうまく機能していない可能性も考え、transform.rotation = mycamera.transform.rotation;も追加した。
Cameraを非表示にした後に現在シーン上にあるカメラを探すコードがなかったのでそちらも追加。
void Update()
{
Debug.Log("mycamera" + mycamera);
if (mycamera!=null)
{
Vector3 lookpos = mycamera.transform.position;
lookpos.y = transform.position.y;
transform.LookAt(lookpos);
transform.rotation = mycamera.transform.rotation;
Debug.Log("mycame");
}
else
{
mycamera = GameObject.FindGameObjectWithTag("MainCamera");
}
}
これにより常にplayerの方に向くようになった。他のキャララクターもdeerと同様の処理を行う。deerだけではなく他のキャラクター選択でのプレイも行う。
Rabbitが生成時にterrain下に落下してしまったので初期のスポーン座標を調整、istrigerの解除。
また、speedを各プレイヤーインスペクターで統一させた。
bearのwalkモーションの揺れがひどいので調整を加える。Bearwalk animationclipのroot transformrotationにチェックを入れた。
これで問題は解決した。
2体目以降のゴーレムのゴーレムソウルの生成がうまくいかず、おそらくすぐに地下に埋まってさわれなくなっている。こちらもy座標を調整する。また、再度プレイヤーがドロップすると、ドロップ場所が想定していた場所とは少し異なるので修正する。
GolemSouldropスクリプトのtargetobjを正確に取得できているかの確認で、再ドロップのソウルの位置の問題は解決できそう。
[PunRPC]
void DoReDropgolemitem()
{
stayitem = true;
Vector3 offset = new Vector3(0, 3, 0);
Debug.Log("targetobj" + targetobj);
this.transform.position = targetobj.transform.position + offset;
rb.velocity = targetobj.transform.forward * 2;
this.gameObject.SetActive(true);
}
2体目以降のゴーレムソウル生成問題はGolemSouldropのupdate関数で座標確認。
ゴーレムソウルの生成問題は既に触れたがカウントに加算されていないだけのよう。しっかり Debug.Log("HitGohlemSoulDrop”);は出ている。
onlythisview.IsMineがtrueになっていない恐れがある。
if (onlythisview.IsMine)
{
golemSoulCounter.SoulCounterplus();
Golemfollowfind.CatchItemList(this.gameObject.name);
Debug.Log("ソウル衝突判定ok");
}
こちらのGolemSouldropスクリプトのログが自分のシーンのログとしてではなく生成元シーンのログとして確認できるのでonlythisview.IsMineの考え方はwolf役にしか適応できないことがわかる。
なので接触したプレイヤー側にこちらのスクリプトを移動させなければならない。HP2scriptに移動させた。
HPScript2 HPScript2 = collision.gameObject.GetComponent();
HPScript2.GolemSoulPlus();
public void GolemSoulPlus()
{
golemSoulCounter.SoulCounterplus();
Golemfollowfind.CatchItemList(this.gameObject.name);
Debug.Log("ソウル衝突判定ok");
}
これでゴーレムの生成元ではない、人間でもソウルの取得が反映できるようになる。
無事に人間側でもソウルを取得できるようになった。
ただ、Golemfollowfind.CatchItemListを動かしてしまったため取得する名前が異なるようになったのでそちらにも対応する。
public void GolemSoulPlus(string soulname)
{
golemSoulCounter.SoulCounterplus();
Golemfollowfind.CatchItemList(soulname);
Debug.Log("ソウル衝突判定ok");
}
こちらでプレイヤー周辺にゴーレムソウルが落ちるか確認。
このタイミングでシーン非生成問題が発生。下記ログのポイントを記録する。
2
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Termcheck:Update() (at /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs:19)
(Filename: /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs Line: 19)
t)
UnityEngine.Debug:Log(Object)
Termcheck:Update() (at /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs:19)
(Filename: /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs Line: 19)
0
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Termcheck:Update() (at /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs:19)
(Filename: /Users/akihironakamura/Desktop/Unity2018/Ethan Project/Assets/Termcheck.cs Line: 19)
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
WARNING: Shader Unsupported: 'Hidden/Nature/Terrain/Utilities' - All passes removed
ERROR: Shader Shader is not supported on this GPU (none of subshaders/fallbacks are suitable)WARNING: Shader Unsupported: 'Hidden/Nature/Terrain/Utilities' - Setting to default shader.
The tree Conifer1_Low must use the Nature/Soft Occlusion shader. Otherwise billboarding/lighting will not work correctly.
(Filename: ./Modules/Terrain/Public/TreeDatabase.cpp Line: 141)