Seems okay to me.
Please refer to this page for how to post code on the forums: Using code tags properly
Couple of small notes that aren’t hugely important, but nice to know…
Bools can be compared like so (no difference, just an option):
if(IsActive) // instead of if(IsActive==true)
// or
if(!IsActive) // instead of if(IsActive == false)
Your code could be slightly shorter, if you wrote:
f(Input.GetKeyDown(KeyCode.E))
{
if(InRange)
{
IsActive = !IsActive; // give the opposite of whatever it is.
Object.SetActive(IsActive); // Setting Object active/inactive based on variable
}
}
I only wrote that to show it could be shortened a little, however I believe readability and comfort are more important than length. You should write what you’re comfortable with and what (for you) is easier to understand