I have a tank object that is my instantiated by Photon. The script that is instantiating the tank object is in C#. I also have a camera with a smooth follow script. The Smooth Follow script is in JavaScript. I need to set the target to the tanks turret, which is a child of the tank object. How can I do this after I have instantiated the tank object?
I have Googled and can’t find anything that works so don’t yell at me for not knowing how to google.
OK, its painful but I got it.
First, go to Edit → Project Settings → Script Execution Order
In the inspector window choose the smooth camera.js script (set as 100 is fine)
Then add your C# script (200 is fine)
If you moved the smoothcamera script from something other then Standard Assets folder move it back (or into a folder called Plugins) this allows the execution order.
Now once you have done all of the above you can create a public variable to contain the smoothFollow.js script. It will NOT autopopulate so be very careful and spell everything correctly. Then drag the gameobject that has the smoothfollow script onto your new variable so it knows where the smoothFollow.js script is located.
Once you have done all of that you can now access the smoothFollow variables like normal, remembering that the variables will not fill themselves in, just type it in case sensitive and you’re good.