How to add an component to PhotonView.observedComponent in script?
Hi, how should i add a component in the script to photon view observedcomponent
Answer by ChristianSimon · May 08, 2017 at 08:20 AM
Hi,
you can use photonView.ObservedComponents.Add(component);
for this. The better way however might be to do this in the editor's inspector.
I tried adding it through an other script to my gameobject that is being created . It works,the only problem is that its not stable all the times . it somtimes add the position and somtimes it doesnt. but overall thank you .
Answer by lupitul · May 08, 2017 at 10:26 PM
Thankyou for your respond. I tried but still getting error . the problem is i need to add a component when the game is running.
Assets/Scripts/CreatingCollider.js(54,111): BCE0017: The best overload for the method 'System.Collections.Generic.List..Add(UnityEngine.Component)' is not compatible with the argument list '(System.Type)'.
Your answer
