- Home /
How do you change the background of an instantiated camera?
I've noticed this weird unity detail where it is impossible to change the camera background if it hasn't been set as such in the start function. This was weird but never really a problem. Now I'm trying to incorporate the work I've already done learning unity in ORK framework and they instantiate the player at the start of levels. So is there any workaround that can solve this? I have a sun and moon that rotate around the player field and they still work fine. The only problem is the animation changing the background to a deep purple and setting the particle system stars to active won't fire.
I've changed this in the Start function:
Vision = GameObject.Find ("Vision");
anim = Vision.GetComponent <Animator>();
to this in the Update:
if (Vision == null) {
Vision = GameObject.Find ("Vision");
anim = Vision.GetComponent <Animator>();
} else
return;
and it has solved the errors caused by the instantiation, but the animation still won't fire. The animator is a component on the camera that's a child object of the player (fps view)
any thoughts are appreciated.