- Home /
observing script with network view
I tried adding a network view to my script and it said no. So i added the view to the object that the script is on and told it to observe the script.
This means that I have two scripts on each object, one for the transform and one for the script. My questions are as follows:
1)Is it possible to have one view observe both the transform and the script? 2)Which view will GetComponent(NetworkView) return? 3)Is there a way to get a handle to both views?
Answer by Dunkhan · Mar 15, 2011 at 01:39 PM
I always seem to end up answering my own qestions :-( So observing a script makes the networkview serialise every time a script variable changes, it doesn't send anything though unless the onserialise method is set for it. 1) sort of, you can observe the transform and still onserialise() script variables, but it wont update very time the script changes so two views is preferable. 2)the first one added. 3)Using GetComponents(NetworkView) (note pluralisation) will return a string containing both views in the order they were added.