Quantcast
Viewing all articles
Browse latest Browse all 83

GetComponent started returning nulls

Hi All, Isololated problem to GetComponent returning nulls. Pulled code fragment from production and made a test case: // Use this for initialization void Start () { FishModel.Type fishType = FishModel.Type.SUNFISH; GameObject fishGO = FishModel.createFish( fishType, lake, turnManager ); FishModel fish = fishGO.GetComponent(); FishModel fish2 = fishGO.GetComponentInChildren(); FishModel fish3 = (FishModel) fishGO.GetComponent( "FishModel" ); BoatSensors sensor = fishGO.GetComponent(); Counter counter = fishGO.GetComponent(); } All the fish give error "Object reference not set to an instance of an object" Other components return correctly![alt text][1]. One test run, all the fish components were correct? The fish prefab has not been touched in months. We say the FishModel script is there and enabled. We need a second pair of eyes to see what we are overlooking. Cheers

Viewing all articles
Browse latest Browse all 83

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>