Reference to another Gameobject in script only seems to update when inspector variable is changed, not if altered in scene. Is this to be expected?
Hi,
I assign an instanced Gameobject A in scene to a respective Gameobject variable in script on Gameobject B by dragging from scene hierarchy view to inspector. This works fine except that when I alter the transform of object A, which changes state of one of A's component whose script has [ExecuteInEditMode], the reference to A in B's script doesn't seem to update even when I press play. The reference only seems to update when a variable of A's [ExecuteInEditMode] component is changed through inspector, ie OnValidate() is called. Is this to be expected? Does a component only give its last validated instance to other components? If so how can I make sure it is validated when I change it in scene view without touching the inspector?
Any feedback is appreciated, Thanks
I'm not totally clear on what is going on/what the problem is, but here are some notes about OnValidate that I think may be relevant:
It's is only called in edit mode when something is changed in the inspector
It is NOT called in play mode unless you call it manually
Your answer

Follow this Question
Related Questions
Cant put Script on GameObject, Help! 0 Answers
Need help with GameObject placement 2 Answers
Survival shooter enemy not taking damage 0 Answers