Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by Spelmyst · Nov 29, 2013 at 05:44 PM · instantiateobjectnetwork

Changing a network object.

Is there a way to change/update/modify a networked player's object after it's been instantiated? I assuming I'm not using the incorrect keywords for searches, because I can't find anything about how to do this.

All of the networking examples I've seen, are referring to instantiating cubes. So, let us assume I have multiple players (like eight of them) that are connected to separate server. Each player has been assigned a human prefab when they connected. One of them runs around and finds a pair of pants. When they put the pants on. How can an RPC be used to update the other players, so they too can see the pants? Obviously the pants have to be a prefab too.

Or can someone point me in the correct direction?

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 Borzi · Nov 29, 2013 at 06:43 PM

Well I don't know exactly how you want to add the pants but usually anything network related should work with RPC's and sync with other players. The hard thing with Networking is that there are many ways to do it and no right one either. I'll show you something I would do (and that I hope works for you):

 public Transform Pants;
 
 public bool PantsCollected;
 
 void Update()
 {
 //If the Pants were Collected
 if(PantsCollected = true)
 {
 //Activate the Pants
 Pants.gameObject.SetActiveRecursively(true);
 }
 
 [RPC]
 void CollectPants
 {
 //Call this function to set the pants to true. With the RPC it will sync to all players
 PantsCollected = true;
 }

This way, the Pants will be visible to all players as "PantsCollected" will be true for everyone on the network (meaning that the other players will recognise the pants as collected and able to see them on your player). This might not be what you want at all of course and I am by no means a very good programmer, yet I still hope that this helped you. Cheers!

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

18 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

Related Questions

How to update a script to a network script 1 Answer

Influencing objects in UNet? 0 Answers

Do I need to instantiate multiplayer assets? 1 Answer

How can I instantiate an Orthello prototype with the Network class? 1 Answer

IgnoreCollision on a Network Instantiated Object 2 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