Using OnWillRenderObject

My code is like this:

var thing : Transform;

function Update(){
		print("it works");

but it says that I need to insert a semicolon at the end of OnWillRenderObject. I clearly can’t use OnWillRenderObject like I should. Can somebody give an example how to use it properly?

No, you don’t call it on the cam… the cam calls it on your Behaviour if the gameObject will be rendered by that cam in that frame…

function OnWillRenderObject()
  print( + ' is being rendered by ' + + ' at ' + Time.time);

Now drag that on some object and start your game and try what happens if you look at it or if you look away


print( + ' is being rendered by ' + + ' at ' + Time.time);

i.e. gameOject to gameObject.