Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by PiFLYON · Nov 05, 2016 at 03:16 AM · multiplayer-networkingspawninglobbynetworkplayer

Network inferno : how to tell a spawned player that it has to defend a gameobject already in the scene ?

Hi everyone, I’ve been searching for hours in the forum and watched a bunch of tutorials, but I don’t find how to do what I want.

(I’m not fluent in english, please excuse any mistake !;-).

I’ve a very simple game for 2 players that works really nice in « solo » mode (versus an AI computer). Now, I’m trying to make this same game work with 2 players (2 humans versus). So I started to work with the network solution built in Unity. I use the free LobbyManager asset. Works fine to match game instances.

But, every time I see a tuto or an documentation, the player example is always defending himself. That’s frustrating ! My problem is :

  • How to tell the « spawned players » which object, already existing in the scene, they have to protect. (« Host gamer you are at position A and must protect existing Weakpoint A », "Client gamer you are at position B and must protect existing Weakpoint B" ) ?

This is in order to make the weakpoint X be able to tell the player X « hey boss, I’m hurt, take Damage ! ». It already works fine in the non-network version (myProtector.TakeDamage(int x)). But, in the network mode, I can not figure a way to associate a pre-existing WeakPoint gameObject to a spawned player (and vice-versa).

I’ve tried so much ways ! The last fail : make a parent containing the weakpoint & the player (so the Weakpoint (child(0)) can know that it’s protector is transform.parent.getChild(1)), but when the Network Manager automatically spawns the entire group, the player SyncVar does not work anymore, neither the Sync Transform (I think because the player is then a child object in this case).

Any little help, even on a small parts, would be a big step for me. (I’m working with C# freshly learned). And if I’m misunderstanding a concept, please tell me :).

Thank you. Cédric.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by PiFLYON · Nov 30, 2016 at 08:32 AM

After a while after having almost given up the multiplayer mode, I got back to it and found a solution, I use the position of the player to know which side of play scene he is. Then I give him a parent containing the differents elements needed (life bar, weak point). Then I define in the player script these elements getting the other children.

As I use the Network Lobby manager with the Round Robin method and StartPositions, I would have prefered to really have the name of the startPosition gameObject instead of checking player's position (if Z<0 he is in the front side, and if Z>0 in the back). But I did not find anyone saying how to do that.

(Now I'm stuck with the Lobby Manager : I did find how to go back to it after Game Over, but I don't find how to go back to leave the Lobby Manager and go back to main menu... I'll ask for another question in the forum).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

77 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unet gameobject activete & deactivete 0 Answers

i just can't seem to figure out how to make a voting system, using SyncVar hooks and commands 0 Answers

Exiting a UNET lobby causes future ClientRPC calls to be ignored. 1 Answer

i just can't seem to figure out how to make a voting system, using SyncVar hooks and commands 0 Answers

[Multiplayer] How to invite friends to a lobby game? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges