네트워크 동기화 문제 해결
몬스터와 크립에 네트워크 관련 컴포넌트가 없는 문제 수정 포탈/캠프와 몬스터/크립 간의 계층 구조 해제 - 네트워크 오브젝트끼리 계층 구조로 둘 수 없음
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyPortal : MonoBehaviour
|
||||
public class EnemyPortal : NetworkBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class MonsterEntry
|
||||
@@ -131,6 +131,8 @@ public class EnemyPortal : MonoBehaviour
|
||||
|
||||
private void SpawnEnemy(GameObject prefab)
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
GameObject enemy = Instantiate(prefab, transform);
|
||||
|
||||
if (enemy.GetComponent<FogOfWarVisibility>() == null)
|
||||
@@ -140,7 +142,7 @@ public class EnemyPortal : MonoBehaviour
|
||||
visibility.updateInterval = 0.2f;
|
||||
}
|
||||
|
||||
enemy.GetComponent<NetworkObject>().Spawn();
|
||||
enemy.GetComponent<NetworkObject>().SpawnWithOwnership(NetworkManager.Singleton.LocalClientId);
|
||||
}
|
||||
|
||||
private void IncreaseCost()
|
||||
|
||||
Reference in New Issue
Block a user