3
\$\begingroup\$

Debugging my code I faced some unexpected behavior.

I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player.

Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player")

What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call.

I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform.

My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations.

Any clue about this?

\$\endgroup\$
1
  • \$\begingroup\$ This has come up in the review queue as needing a verifiable example. If you're still interested in answers to this question, please consider adding a minimal complete example of the code that reproduces the issue. (Or, if you've discovered the reason for this effect in the time since 2015, it would be great to write up what you've learned as an answer) \$\endgroup\$
    – DMGregory
    Jun 6, 2017 at 21:44

1 Answer 1

-1
\$\begingroup\$

http://docs.unity3d.com/ScriptReference/GameObject.FindGameObjectsWithTag.html

Returns a list of active GameObjects tagged tag. Only Find GameObject at root of scene, No recursive.

\$\endgroup\$
1
  • \$\begingroup\$ And that's what I was used to know. But when I send via RPC another GameObject it gets added to Hierarchy temporary (for the duration of function execution). That Object includes only its transform and has not any other component. My question (I apologize if it was unclear) was to explain me this behavior. Maybe is there some limitation on parameters type passed via RPC or something else? \$\endgroup\$
    – Leggy7
    Apr 1, 2015 at 12:44

Not the answer you're looking for? Browse other questions tagged .