playMaker

Author Topic: Photon Setup  (Read 730 times)

Matthew Reilly

  • Playmaker Newbie
  • *
  • Posts: 20
Photon Setup
« on: June 26, 2019, 03:40:34 AM »
Hi,

I've been struggling with Photon setup. I've got a 4 player selection screen & need to adapt the online documentation to suit my setup. It's not clear to me, but this is my very first time trying multiplayer (& I'm unclear on several points). Most importantly, the spawning logic doesn't make sense to me.
 
Given that my prefab resource folder players can't communicate with my hierarchy GUI objects, I've been spawning an empty prefab (w only transform & view / sync components) & positioning it next to / as a child of a hierarchy player that is activated and given a view component. This isn't working, as the two conflict & the movement goes bonkers. I know some tutorials say delete the hierarchy player, but then I have no one to click UI buttons & make things go. I figured that an empty spawn / activate player might get around Photon's prefab requirement, but it isn't working. I'm getting 2 clones of player prefab as well, if that means anything.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Setup
« Reply #1 on: July 04, 2019, 05:09:22 AM »
Hi,

your hierarchy of UI objects should be accessible by any gameobjects, for example, you can use tag, and when you spawn a prefab instance, the instance first job is to find the UI object in the scene that it needs to communicate with.

for example a HUD display over your player instance can be made in two different ways:

- either you have a specific UI canvas inside your prefab and you destroy it or change it based on who owns it
- or the UI HUD is managed by scene manager which instantiate a non networked Object ( the UI HUD), and tells the player instance about this HUD so that it can control it ( for health for example), then the manager can decide what to do and where to put it as well as destroy it if the player is disconnected.

Bye,

 Jean
Bye,

 Jean