I have a script in which exists a fade prefab!
The following code snippet instantiates the prefab during run-time, as can be seen in the attached image.
public void Begin( float fadingTime ) { this.fadingTime = fadingTime;
fade = Instantiate(fadePrefab) as GameObject;
fade.transform.parent = Camera.main.transform;
fade.transform.localPosition = new Vector3( 0, 0, 0.31f );
fade.transform.localRotation = Quaternion.identity;
I still get this error message though:
NullReferenceException: Object reference not set to an instance of an object SceneManager.Begin (Single fadingTime) (at Assets/Scripts/SceneManager.cs:57)
Given that I can see the prefab is cloned, I am confused why I get this error message. Please see the attached pic.
So, I thought perhaps I should include something in the code to see if the prefab is indeed instantiated, but I don´t know how to test this.
For example, sometimes we put in such a thing to see if something has some value:
Debug.Log( "I get to this point" + someVariableValue );
What do I test for or how do I do this test, because I have no clue why I am gettig this err msg...
Thank you,