- Home /
camera . smooth follow
Okay so i have a big problem in making my camera follow my target AFTER switching scenes here is a piece of the code which will help you to understand my problem
camR = GameObject.Find("cameraRoll");
cameraRoll is the name of my camera camR is a gameObject
I think i just need to attach a smooth follow script to my camera but IN CODE and i have no idea how to do that .
if i could have the smooth camera script attached to camR then do this camR = GameObject.Find("cameraRoll"); it would probably make my camera follow my target perfectly after switching scenes right ?
how is this done ? i have tried to make it work countless times .
does cameraRoll and camR both exist in the next scene? I don't really know what this could be. I would assume it has something to do with object references after switching - e.g. issues with finding the gameObject.
Answer by corpius4 · Jan 03, 2012 at 06:34 PM
You do not have to add it in script. Put that entire script it in a "function" and then call that function whenever you want by typing it like so:
function nameOfFunction()
{//insert script}
//call function
nameOfFunction();
for more information on functions go here: http://www.youtube.com/watch?v=4j-lh3C_w1Q
Your answer
![](https://koobas.hobune.stream/wayback/20220613062635im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
toggle buttons 2 Answers
Character Contolller Hit 3 Answers
Inheritance Start ok, Update ko 1 Answer
Object refernce not set to an instance of an object .... 1 Answer
None (Physics Material) Properties 1 Answer