please help …
have a look here - http://www.image-share.com/ijpg-940-33.html
wat will be the line of code to enable it in c# ?
please help …
have a look here - http://www.image-share.com/ijpg-940-33.html
wat will be the line of code to enable it in c# ?
if the script turning on or off the the component is on the camera itself aswell:
GetComponent().enabled
false or true
if your trying to change it elsewhere, as long as the tag for the camera is mainCamera you can find the camera via Camera.mainCamera and then do the .GetComponent part there. But be careful that you do not get a null from either Camera.mainCamera or GetComponent() before modifying anything. If mainCamera returns null it means the cameras not yet set up or theres no camera with tag of mainCamera.
bingo man !!
Last thing - there is a property in this script called Ramp offset, i want to turn it to lets say 1 via script after enabling the script…
can u guide me on dat too
as long as its a public variable you’d take the same steps to get .enabled but instead with ( what i’m guessing the name is ) .rampOffset
it could be .RampOffset though, but at the point where you’ve got the GrayscaleEffect component you can modify any public variables in it, so taking a look at the class can be revealing. But with that said its not safe to say every script is designed to have their values modified at runtime, good scripts would mark those things as public though. but if it works in the inspector at run time your probably fine.
that script says
public float rampOffset;
so our script will become
Camera.mainCamera.GetComponent<GrayscaleEffect.rampOffset>().enabled = 1;
tis is giving err
Camera.mainCamera.GetComponent().rampOffset = 1;
thanks its done man…