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
0
Question by Cabooska · Sep 24, 2013 at 12:38 AM · instantiatephotonparentchildclient

Phonton: Clients do not see child/parent relationships

Hello all,

The game: I'm working on a 2D side-scrolling game that uses PUN (Photon Unity Network). When the game starts, the client that joins first creates the room for other clients to join.

The idea: When instantiating a prefab, make it the child of another object; therefore the translation of the parent would also translate all children attached. In the game, the player and weapon get instantiated using:

 GameObject myPlayer = PhotonNetwork.Instantiate("prefab", new Vector(x, y, z), Quaternion.Identity, 0);
 GameObject weapon = PhotonNetwork.Instantiate("prefab", new Vector(x, y, z), Quaternion.Identity, 0);

note: prefab, x, y, and z have actual values. The prefab is located in the Resources folder. Each object has the "PhotonView" script attached as well.

Upon creation the instantiated (weapon) is made a child of the parent(player).

 weapon.transform.parent = myPlayer.transform;

The idea works, and the weapon object(child) follows the player(parent) around with a separate movement script. The movement script is not part of the prefab, rather added upon creation.

The problem: Although this attachment of child-parent works for the client's respective player-weapon, it does not seem to attach the two for other client's player-weapopn relationship. It works just fine if weapon is already a child in the prefab, but I'm trying to avoid this.

Here is a link to the youtube video visualizing the problem: http://www.youtube.com/watch?v=EDXLo63QNGM&feature=youtu.be

Opening a client and playing through the editor, you can see that the editor's player-weapon are attached. When the other client joins, the weapon is not attached in any way; even though it is attached to the clients player object with it's own Photon View transformation component. It should be moving, it was instantiated on the photon network and attached to the player. Very odd.

I've looked at some similar issues but the threads either died or were never resolved.

Things I've tried:

  • Make the weapon a child of the player in the prefab : works, not what I want though.

  • Make a separate moving script for the weapon similar to player : works, not exactly efficient or desired.

  • Making the photon view point to different things; i.e. transforms, a lerp script. Neither fix issue. Although the player is using this Lerp script and it works as seen in the video.

some research of similar issues but not quite:

http://answers.unity3d.com/questions/534313/text-name-above-players-head-in-photon.html

http://answers.unity3d.com/questions/312665/networkinstantiate-problem.html

Any tips, info, or potential solutions would be greatly appreciated! Thank you.

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
Best Answer

Answer by Cabooska · Sep 27, 2013 at 10:19 PM

I've figured out a solution. It was a matter of ensuring all clients attach the said object with a photon view to the character. Although this solution doesn't answer my question directly, it will work for now.

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

15 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

Related Questions

Make a simple tree 1 Answer

How can I make a game object follow an instantiated game object? 1 Answer

Instantiated GameObject collision without script repetition? 1 Answer

iOS Instantiate transform as child -- positioning bug 2 Answers

How do I instantiate and set the parent of a Gameobject using Photon? 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