I am trying to run some playmode tests on part of my game. The environment is setup through a component script within the prefab. Certain fields of this script are used as variables to change the the environment. These are public so they can be changed in the inspector.
The prefab is loaded like this:
AssetDatabase.LoadAssetAtPath("Assets/Prefabs/Prefab.prefab")
It is then instantiated and the component script is accessed through a GetComponent<> ( ) on the instantiated prefab.
I then try to manually change the fields, e.g:
instantiatedPrefabScript.environmentVariable = 1;
When I run the tests however, the camera shows the instantiated prefab with the default values passed in through the inspector, rather than the ones I have changed.
Also, when I Debug.Log the fields, they show up as the desired variables.
What is going on?