Is there any way to lock an object not to be selectable?

If someone is still looking the solution, you probably can find it here