- Home /
Question by
marcusgray · May 26, 2014 at 03:49 PM ·
transform.
Passing Transform into Coroutine
public Object prefab;
void Start () {
Transform obj = (Transform)Instantiate(prefab);
StartCoroutine(routine(obj));
}
IEnumerator routine(Transform obj){
print(obj);
}
I get 'Null'
Since you can't use 'ref' in a coroutine, how could I pass the exact transform object into 'routine()'?
Comment
The error you should also get is that you are not returning anything. Now before bla$$anonymous$$g the coroutine, check that the obj is not null. $$anonymous$$aybe your instantiation goes wrong.
You're right, it didn't like being cast as a transform. Thanks
Your answer
Follow this Question
Related Questions
Parent Game Object to Camera? 2 Answers
Vertex element compression 0 Answers
2D Shooting right only. Doesn't flip direction with character 1 Answer
2D Spawn with fixed random locations 0 Answers