Search Unity

Single Player vs Multiplayer Scripts

Discussion in 'Multiplayer' started by Kiesco91, May 25, 2021.

  1. Kiesco91

    Kiesco91

    Joined:
    Aug 20, 2018
    Posts:
    80
    Morning All,

    Im working on my first multiplayer game. nothing big, just a 2 player co op game. ive decided to use Photon PUN which is working great for a lobby, spawning characters with syncing movements etc. my question is kind of a 2 part question.

    Part A: my player is a prefab in the Resources folder of my project. On the player script, i have:

    public gameObject _key:

    the key is placed in the world but i cant drag that key from my hierarchy to the slot on the script in the inspector. do i need this to be a prefab in the resources folder aswell? ive done this in a single player game and have got it working easily without problems so not sure why i cant assign it now.

    Part B: im trying to get an inventory system to work. just a simple bar at the bottom of the screen with 5 slots that when i pick something up, it goes to an inventory slot. again, ive done this with a single player and it worked but i feel the scripting will be different as there are 2 people with 2 separate inventories. ive looked at the Photon Documentation but cant really find anything discussing this. i saw maybe i need Photon BOLT or Photon Realtime. could someone point me in the right direction for this?