How can I resolve the error "In Powerup: Found more than one edit/visibility specifier (VisibleDefaultsOnly), only one is allowed"?

I am now looking at a pizza tutorial.

But now, an error occurred.

This section, which
UPROPERTY (EditDefaultsOnly, VisibleDefaultsOnly, Category = Powerup)

Error information
error: In Powerup: Found more than one edit / visibility specifier (VisibleDefaultsOnly), only one is allowed

Can you possibly know what the problem is?
Thank you.

VisibleDefaultsOnly is EditDefaultsOnly are specifiers which set access property in property editor, you can’t use both of them is same time, you need to pick one of them.

  • Visible* = Read-only
  • Edit* = Read-Write

In other words you trying to make your property Read-Only and Read-Write in same time :stuck_out_tongue: Considering you trying to use “EditDefaultsOnly” means you just need this one, so remove “VisibleDefaultsOnly”

Hi Jihun.

There are a couple problems here. The first is that you are setting both an Edit and a Visibility UProperty for the variable. You are only able to have one or the other in the UProperty list (just an FYI, the EditDefaultsOnly flag includes the VisibleDefaultsOnly tag).

The second issue is that the TSubobjectPtr variable you are implementing the UProperty flags for (if I found the same tutorial that you were looking at) cannot be set to editable, so you will only be able to use the VisibleDefaultsOnly flag.

Try using the following line:

UPROPERTY(VisibleDefaultsOnly, Category = Powerup)

That will resolve the error message you were seeing.

Have a great day.

Thank you for good answers.
Now, I will understand.
Thank you. and

Thanks

I had this same issue. So is the tutorial wrong? If so Epic should not be letting people follow it if its wrong, it should be removed or correct it. Unless this is some kind of test :slight_smile:

Hi BGPROCKSGAMING,

I have let the developer who created the video know about the discrepancy. I do not know yet what we may do to resolve it.

Can just place a comment in the video at the point. The developer pasted in the code as the video progressed, so I figured it was compiled and work. And it might have worked in the older release, and you guys probably just changed something.

that’s the video, and the code in question was pasted in at: 12:17 in.

Hi BGPROCKSGAMING,

We have added some annotations to the video with the correct code to be included in the two spots where the code in the video will no longer work correctly.

You guys are awesome!. With support like this, the power of game devs everywhere can finally be unlocked :slight_smile: