- Home /
Can I comment this default parameter out and be fine?
So I have been using a the basic RPG camera from asset store to great success. While adding my AI and combat scripts I got a "Default Parameter Specifiers not permitted" error when debugging on the player camera scripts here...
public void SetLocalRotation(float rotation, bool withCamera = false )
What I did as kind of a work around is just commented out the false like so...
public void SetLocalRotation(float rotation, bool withCamera / = false /)
Everything seems to work fine now, but will this come back to bite me in the ass or no?
I dont even know what the error means. Thanks for the help in advance!
Answer by Owen-Reynolds · Jun 11, 2015 at 05:01 PM
All a default parameter does is allow a shortcut. You can call the function with just rotation
and the computer will fill in false
for the withCamera
input. If you never use the shortcut (you always give both inputs,) it doesn't matter.
If anywhere else in old code is using the shortcut: SetLocalRotation(rotation);
, you will definitely get an error right away. All you have to do is fill in the missing false
.
Can also look up what a default parameter is. It's a regular C# thing.
Your answer
Follow this Question
Related Questions
Having Text Or Notes In The Inspector? 6 Answers
Does comments reduce FPS? 1 Answer
delete comment lines on final build 1 Answer