Einstein's field equations in general relativity admit a variety of solutions with spacetime singularities. Numerical relativity has recently revealed the properties of somewhat generic spacetime singularities. It has been found that in a variety of systems self-similar solutions can describe asymptotic or intermediate behaviour of more general solutions in an approach to singularities. The typical example is the convergence to an attractor self-similar solution in gravitational collapse. This is closely related to the cosmic censorship violation in the spherically symmetric collapse of a perfect fluid. The self-similar solution also plays an important role in critical phenomena in gravitational collapse. The critical phenomena are understood as the intermediate behaviour around a critical self-similar solution. We see that the convergence and critical phenomena are understood in a unified manner in terms of attractors of codimension zero and one, respectively, in renormalisation group flow.