playMaker

Author Topic: PhotonNetwork.InstantiateSceneObject  (Read 23567 times)

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject[SOLVED]
« Reply #15 on: July 21, 2014, 08:17:13 AM »
Hello, thanks for reply,

Playmaker is awesome in general, im no scripter so its my main tool:)

AI was ment like Bot/NPC human not controlled by player. They walk around and players can interact with them.
For now when Player joins a room, he can spawn Bots (with photon.network.instantiate) or interact with others (which are spawned by other Players). Problem here is if any player disconnects all his bots deletes too.
So I thought I could instantiate bots as scene objects so they stay on scene.
Or am I thinking wrong?

I understand there are no custom action "photonNetwork.instantiateSceneObj" available?
Could not find where to download,
maybe someone can link me?

Thanks!
« Last Edit: October 21, 2014, 02:24:01 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonNetwork.InstantiateSceneObject
« Reply #16 on: July 21, 2014, 08:25:37 AM »
Hi,

 d'oh, forgot the attachement, go back to my post above, I have added the action to the post.

But in your case, you are overthinking this I think. If you instantiate a prefab it will be at the position you defined on ALL running instances, and so you only need one place to compute the AI for the position, and it will spread naturaly.

Bye,

 Jean

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject
« Reply #17 on: July 21, 2014, 08:32:48 AM »
Thanks alot for the action!

and thanks for your input, I will rethink the idea and test it with this new action:)

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject
« Reply #18 on: September 26, 2014, 12:10:07 PM »
Hi,

I'm getting one error on InstantiateSceneObject:

Works all good when two players joins a room and one of them instantiates a scene object.

Error:
If one player creates a room, instantiates a scene object and only then other player joins, "slave" client gets an error, please see in image bellow.

After this error everything is still running.
Is this something to worry about?

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonNetwork.InstantiateSceneObject
« Reply #19 on: October 15, 2014, 01:24:51 AM »
Hi,

 that's odd, I don't experience this here. Let me digg further, I have to update to the latest version of Pun anyway, so I'll double check this.

Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonNetwork.InstantiateSceneObject
« Reply #20 on: October 16, 2014, 03:04:54 AM »
Hi,

 are you referencing an object that is a prefab within a Resources folder? that scene object must still be a prefab like any other prefab you instantiate with Photon, even if already in the scene.

 Bye,

 Jean

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject
« Reply #21 on: October 16, 2014, 04:52:26 AM »
Hi, thanks for your replies.

I will check and report back in upcoming days.

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject
« Reply #22 on: October 16, 2014, 02:51:56 PM »
Hi,

its a prefab in Recources folder same as other prefabs for regular photon instantiate.

Made a new scene with a Cube prefab and getting same results.
Attached an image of cubes setup just in case, it has an empty fsm on it.

Versions:
Unity 4.3.4f1 + PM 1.7.7.f6 on a mac

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonNetwork.InstantiateSceneObject
« Reply #23 on: October 20, 2014, 03:00:17 AM »
Hi,

 ok, I was able to repro and fix it, I have also updated the pun package to use 1.28.3, so it's all up to date now.

https://hutonggames.fogbugz.com/default.asp?W928


 I added also an action NetworkGetIsMasterclient cause InstantiateSceneObject can only be called is you are the masterclient, and so it will be easier to use the action isMasterClient to make sure you have the right to call it.

 the error you had was in the debug system where I exepted some message info that is not there in our case.

Have a go and let me know if it's ok.

 bye,

 Jean

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: PhotonNetwork.InstantiateSceneObject
« Reply #24 on: October 20, 2014, 10:14:32 AM »
Thank you very much!

This is super awesome!

Tested the update and all works well - scene Objects being instantiated with no errors.

+ with this update Room Custom properties can be used in Offline mode :)

Thanks!!

kanae

  • Junior Playmaker
  • **
  • Posts: 52
Re: PhotonNetwork.InstantiateSceneObject
« Reply #25 on: October 20, 2014, 10:48:17 PM »
Thanks for this, needed it too! :)