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 oliver-jones · May 23, 2012 at 09:32 PM · transformspawnrpcidunique

RPC - Transform not Supported?

I'm working on a spawn script for my network game, and I need my RPC to respawn a dead player to all the clients. But I can't have a that 'dead players' transform as a parameter, so how else would I uniquely identify the dead player in the RPC, to be able to spawn him?

I hope this simple question has a simple answer :/

Thanks again,

Ollie

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

Answer by whydoidoit · May 23, 2012 at 10:02 PM

You can't send the transform but you can send the position and the rotation - RPC supports Vector3 and Quaternion.

You can use the networkViewID to identify the character or if that isn't working you could create a unique identifier as a string.

A good way of doing that is to use a Guid and turn it into a string:

 public string id = Guid.NewGuid().ToString();

You will need to import the System namespace to access Guid

Comment
Add comment · Show 12 · 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 oliver-jones · May 23, 2012 at 10:05 PM 0
Share

Is there another form of identity for RPC? Also, inside my RPC, lets say I have Destroy(gameObject), is that gameObject referring to the object the RPC is actively on, or all the gameObjects that the RPC will be sent to?

avatar image whydoidoit · May 23, 2012 at 10:07 PM 0
Share

Inside the RPC call that will run on every object that receives the call - so if you do an All or Others then it will run for that particular instance on all of the other games.

Rather than destroying the GameObject you could always just put it into hibernation until it respawns....

avatar image whydoidoit · May 23, 2012 at 10:08 PM 0
Share

But it will only happen for the viewID that you specify - so that will be that particular instance on all players computers - not all gameobjects of that type. Ugh my English is failing me :) Told you it was $$anonymous$$d bending...

avatar image oliver-jones · May 23, 2012 at 10:12 PM 0
Share

How would one specify an object via networkViewID? Eg: (networkID).gameObject.enable = false

avatar image whydoidoit · May 23, 2012 at 10:17 PM 0
Share

On a particular computer or everywhere? BTW gameObject doesn't have an .enable - but components do. GameObject has the whole setActiveRecursively() and active stuff.

If you mean everywhere then you can call NetworkView.Find(ID) and then RPC that with a call to something that will set the active status or disable/enable the renderer

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem getting prefabs to spwan correctly from within RPC 0 Answers

Send array of transforms via RPC. [C#] 1 Answer

Unique ID Assignment 0 Answers

Need instantiated objects to spawn at transform NOT at origin?(Solved) 2 Answers

Getting Xbox 360 User ID (Or some sort of unique identifier) 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