- Home /
How to get a gameObject having viewID?
So the question is in the head. Using RPC function I can send from server viewID objects. On clients i need get gameObjects which own networkViews of that sent viewID. There supposed to be that kind of fuction I guess.. because only one gameObject has the viewID. At this moment I get all the networkViews and compare the viewId. The problem is that I have the function called many times in frame, so there must be easier way. Thank you.
Answer by syclamoth · Oct 12, 2011 at 04:38 PM
You should be using NetworkView.Find(viewIDinQuestion). This returns a NetworkView, from which you can determine the object! This is all in the documentation.
Thank you so much. Didn't know that NetworkView had a static fields. It's suposed to be in Network class :)
Just a friendly re$$anonymous$$der: There's no need to disparage people. This comment is in fact the #1 google result for: "unity find object by viewId", so congratulations, you are the documentation.