Avoid public variable to get overwritten by the Inspector

How to Avoid a public variable to get overwritten by the Inspector?


I have public variable like so:

public class Bullet{

//it is default 0 in the Inspector
public float Damage;

I do not want to write in

I have a Manager Object which does:
//Called only rarely and not per each time I enable the bullet

For each Bullet object b,

But I keep getting 0 and not 100;
Please Help!
I tried:
public float Damage;
but didn’t work.

You can try hiding it from the inspector. Add [HideInInspector] above the definition, and see if that helps. It will let you keep the variable public, but not show up in the inspector.