22.06.30
Stream
- File Stream
- Binary Stream
ํ์ผ ์ ์ฅ
- Class ๋จ์ ์ ์ฅ
- ์ง๋ ฌํ
- Stream ๊ธฐ๋ฐ (Binary)
- Open / Close
Unity ์ค์ต
- ๋ชจ๋ฐ์ผ
Stream fs = new FileStream(path+"MySaveData.sav", FileMode.Open); //Mobile์ฉ
print(fs);
if(fs != null)
{
//์ ์ฅ
BinaryFormatter bf = new BinaryFormatter(); //๋ฐ์ด๋๋ฆฌ๋ฐฉ์์ผ๋ก ๋ค์ํ ์๋ฃ๋ฅผ ํ๋ฒ์
saveData = (SaveData)bf.Deserialize(fs); //๋ก๋
fs.Close();
}
๋คํธ์ํฌ ๋ฐฉ์
- Client - Server
- ์ ํต์ ๋ฐฉ์
- ๋ฉ์ธ ์๋ฒ ํ์๋ก ์กด์ฌํด์ผํจ
- ๊ฐ ํด๋ผ์ด์ธํธ์ ์์ฒญ์ ์๋ต
- Listen Server : Photon pun(bolt)
- ๋ฉ์ธ ์๋ฒ ์กด์ฌ ํ์ X
- ์ ์ ํ๋ณ์ ์ํ ์ต์ํ์ ์ ๋ณด ๊ฐ์ง
- ์ ์(๋ก๋น), ๋ฐฉ(๊ฒ์)
- User๊ฐ ์ง์ ๊ฐ์ค, ์ฐธ์ฌ
- ๋ฐฉ์ ๋ง๋ User : ๋ฐฉ์ฅ
- ๋ฐฉ์ฅ ์์ด์ง๋ฉด ๋ค์ ๋ฐฉ์ฅ์ ์ ์ถ
- ์ฐธ์ฌํ User : ๋ฉค๋ฒ
๋คํธ์ํฌ ๊ฐ์ฒด
- ๋ด ํด๋ผ์ด์ธํธ - ๋ด ๊ฐ์ฒด(Player)
- ๋จ์ ํด๋ผ์ด์ธํธ - ๋ด ๊ฐ์ฒด(Remote Player)
- ๋์ ๊ฐ์ฒด์ ์ ๋ณด๋ฅผ Remote Player์๊ฒ ์ ๋ฌํ๋ ๋ฐฉ๋ฒ
- ๋ด๊ฐ ์ ์ดํ๋ ค๋ ๊ฐ์ฒด๊ฐ ์์ ์ธ์ง Remote์ธ์ง ํ๋ณ ํ์
Photon ์ค์ต
๋น๋์ ํ๋ก์ ํธ ํ์ผ ๋ด์ ๋ง๋ค ์ ์์ ๋ฐ๋ก ๋ง๋ค์ด์ผ
//๋คํธ์ํฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐ
**using Photon.Pun;**
**using Photon.Realtime;**
public class PlayerControl : **MonoBehaviourPun**
- Unreliable - ํญ์ ์ฑํฌ ๋ง์ถค
- Unreliable On Change - ๋ณํ ๋ฐ์์ ์ฑํฌ ๋ง์ถค
public class PlayerControl_Sync : MonoBehaviourPun, IPunObservable //๊ฐ์ฒด์์ ์ฑํฌ๋ฅผ ๋ง์ถ๋ ์ธํฐํ์ด์ค(ํ๋กํ ์ฝ)
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
throw new NotImplementedException();
}
'๐ฎUnity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ML-Agents] ML-Agents ํบ์๋ณด๊ธฐ (0) | 2022.08.08 |
---|---|
[photon] ๋ฐฉ ๋ง๋ค๊ธฐ, RPCs (0) | 2022.07.31 |
[VR] ๊ฐ๋ฐ ํ๊ฒฝ ์ค์ - OVR (0) | 2022.07.31 |
Graphics / Line (0) | 2022.07.31 |
[Unity] ์ค์ต_ObjectPool (0) | 2022.07.31 |
๋๊ธ