Firstly, you must update your bank branch with your email id. For that, you need to visit your branch and fill-up the required form. Carry your PAN card copy and original one for verification, if required.
After that, follow the below steps.
To create online username and password to view your Union Bank of India account details online like savings account, visit https://www.unionbankonline.co.in/
On the main screen, click on "Self User Creation" on top-left menu link. See below.
On the Click on the said link, you'll get the screen like this.
Just fill up the above form with your details like ATM card no., PIN, date of birth, etc. After you click on submit button and it accepts your details, it will ask for password and will show your username.
You need to wait for at least 2 days then to login for the first time on your newly created account.