Which graphic card for Unreal Engine ?

i will buy new graphic card. I want to buy sapphire rx580 gb nitro+ (or pulse) graphic card. But, price difference between 4 gb and 8 gb.
option 1: rx580 8gb - 1500₺ (Turkish Lira)
option 2: rx580 4gb - 950₺ + 16gb ram 800₺ = 1750₺

I have a 16gb ram. If I will buy 8gb I cant upgrade ram to 32gb. But If I will buy 4gb I can upgrade the ram to 32gb. What I sould do? Which most important? 8gb graphic card or 32 gb ram?
Maybe I should buy only rx580 4gb. Do I need the 32gb ram? 4gb ram is enough for UE4?

I’d go for the better GPU, its the better investment, since you can always buy RAM later on and you already have plenty of it right now.

When i bought my rig, i had the R9 390 with 8GB and 16GB DDR3. A few months ago I upgraded to 32GB.

Thanks for reply. You’re right. I sould buy better graphic card.