Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by sman_47o · Jul 28, 2012 at 02:52 AM · multiplayernetworknetwork instantiateobject position

Network Objects given the wrong position

When I instantiate an object with this code:

 if(Inv[i] != NewItem){ 
     NewItem = Network.Instantiate(Inv[i], hand.position, Quaternion.identity, 0);
 }
 NewItem.transform.parent = hand;
 NewItem.transform.rotation = hand.transform.rotation;

The client that is instantiating NewItem properly receives the position/fact that it is parented but all the other clients only see the NewItem for a split second at its assigned position and then NewItem's position is set at 0,0,0. Part of me feels that I need to us NetworkOnSerialize or an RPC call to update the parent but i also feel like if I can avoid spending hours on those functions and realizing it's something client side is a good idea (the amount of hours I've wasted on NetworkOnSerialize is just sad).

Thanks for any response I'm open to them all.

Comment
Add comment · Show 1
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
avatar image SomeGuy22 · Jul 28, 2012 at 03:31 AM 0
Share

First off, is that code in an RPC call? If not, it should be. Second, is there any code that moves NewItem around besides this one?

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Jul 28, 2012 at 03:33 AM

Do you parent the object on the other clients? i guess not. when you parent an object, that action isn't synchronised because that's even not possible / or very hard to achive automatically. Each client has it's own set of gameobjects. The only connection between a GO on your PC and a GO on another PC is the NetworkView. If they have the same ID they are "linked" together. The only thing that is synced is the local position and rotation. You actually don't need a NetworkView on the item when it's not moving on it's own.

You usually would send an RPC that tells everyone that you want to attach the object to your hand. I can't be much more specific since the actual process depends on your setup. How you can identify your objects / players on each client and so on.

Comment
Add comment · Show 1 · 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
avatar image sman_47o · Jul 29, 2012 at 12:20 AM 0
Share

It worked thank you so much for the quick response you saved me so much time it isn't even funny.

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

7 People are following this question.

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

Related Questions

Unity Network problems, updating an individual object 0 Answers

Instantiated Object not appearing for remote players 0 Answers

UNet changing player prefabs int the network lobby sample. 0 Answers

Unity multiplayer solutions: Photon, Unity Networking - what else and in what way is good? 0 Answers

Main Parameters of MP game for Clients to Join 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