How to stop rider from moving events from top of class?

If I declare a event like below on top of my class

public event EventHandler OnSelectedUnitChanged;

Then when I save the file the line is moved to middle of my file where functions are present.

private bool Update()
{
// Something
}
public event EventHandler OnSelectedUnitChanged;
private bool TryHandleUnitSelection() 
{
// Someting
}

I am unable to fine any formatting rule to fix this. 

0
1 comment

Prakhars144, it sounds like your project might contain file layout rules described in Rearrange members with file and type layout patterns.

Could you check:

  • If this behavior persists when you run a cleanup profile with the Apply file layout option disabled (see Apply file and type layout with custom Code Cleanup profile)
  • Check if Settings | Editor | Code Style | C# → File Layout contains any relevant rules. Note that, depending on your project type, you might need to switch between “General” C# rules and “Unity” rules by selecting the corresponding tab:

0

Please sign in to leave a comment.