The code given by saeedc cannot be used outside of class’s constructor. That’s exactly what the error says:
FObjectFinders can’t be used outside of constructors to find Blueprint’/Game/Test.Test’
The code given by saeedc cannot be used outside of class’s constructor. That’s exactly what the error says:
FObjectFinders can’t be used outside of constructors to find Blueprint’/Game/Test.Test’