Disclaimer: I don't know if this would be the technique that one should use and if it is a technique that has been used for meditative purposes, but this is a question just out of curiosity
Sleep is a natural required process but it's really sad that we got life and we sleep 1/3rd out of it(I mean serious). Even the scriptures say that sleep is necessary and it seems training to unsleep(atleast for human) isn't a good practise(Mentioned even in the Bhagwat Geeta by Lord Krishna that sleep is inevitable and necessary).
But, there is a point where we could do both sleep and unsleep at the same time. The idea is to remain concious during your sleep, let your body heal in this sleep state but put your mind concious while you control your dreams. There you can uplift yourself to any aspects and I think this could be a perfect opportunity to overcome your flaws or even a place to start your spiritual journey. Some people call this lucid dreaming(albeit I don't know if this is a term since it's not only being aware but also manipulating your dream at will) .
Are there any scriptures/mentions of such spiritual techniques(or even just dreaming in general) that help you uplift yourself to spiritual awareness while dreaming by manipulating your dream?(e.g. you'd create a most silent and comfortable place where you meditate in your dream)