Object reference is not compatible!

Hi,
I’m new here in this forum, not sure if this is the right place to post this question!

I have promoted a variable (Speed Button W) to a variable (Current Active Button). Now when I need to set this new variable to another variable UE doesn’t allow me and show a message “Object reference is not compatible with … object reference”. I just can’t understand why when all the variables on the left variable panel are of the same type!

Any clue how can I change the variable (Current Active Button) to Music Button W? :thinking:

Your help is much appreciated.

Just make the SET node by dragging from the button reference.

Do you mean by dragging it from the “Music Button W”?
When I drag from this button I don’t find the variable “current active button” which I want to set, in the drop down menu! :man_shrugging:

Ok, I see.

Your variable needs to be of type ‘Button’

1 Like

Thanks… I found out that each one of my variables on the left panel is of a type of its own! I think this is the issue! I created each one as a widget. I don’t why they’re not showing all as widgets here!

I’ll have to check for a way to fix this…

1 Like

image

image

In UE4 some native widgets were exposed by default, others had to be flagged as variables. User Widgets had always been exposed. Now they are not…


This will result in confusion since UE4 tuts are numerous and the authors never had to cover this specifically.

1 Like

You’re right. So if I exposed these variables, will this fix my issue?
I have checked all my widgets and found that they’re set as variable (“Is Variable” the tick in the image you attached). However, They’re still not exposed!

Any idea why?

Cheers

Show us an example.

Expose to see the events and variables for this element in this blueprint:

This only propagates from child → parent, not from child → grandparent, ofc.

Here’s an example, The button ACButton is se as variable inside a widget called “MusicButton_W”. Now, when I added the “MusicButton_W” widget into another widget, it appear to be "not public and will not be editable!

I’m kind of lost, why the widget is not public when it is a variable? I couldn’t find a box to make the widget variable. I’m using UE 5.1…



You can ignore that closed eye. It means nothing here and it’s supposed to be like this. You can access it anywhere you want. By telling you it’s non-editable, the editor is preventing your from dereferencing it and leaking memory.

The top one is the actual button widget that you’ve placed in the designer - if you edit the ref itself, you could lose your button!

The one under it is an empty button reference variable I added a real button can be assigned to as value.

If you do so:

image

Those two events will fire from the same button because both references point to the same button object now.


It’s the 4th or 5th time I see it mentioned this month only. Is there a specific tutorial that mentions this?

1 Like

Yes. I was trying to control a button with the controller. So, I watched the following tutorial on YouTube.

1 Like

Not sure what that means tbh. But how does it prevent you from doing what you need?

I mean I want to use a controller (i.e. Dualshock 5) to interact with the buttons inside of a widget. In another words, I don’t want to use the mouse to do so.

Makes sense. But what issues did you encounter because of the eye? Because if you refer to this:

It’s just incorrectly assigned data type.

Well… I’m not sure if the eye is the issue or not. All I was trying to do is to set a variable to another button. Then the issue of “object reference not compatible” showed up!

It has nothing to do with it. This type is wrong / strange:

image

Not sure what this is supposed to be.

Should be just button:

image

Unless we’re using custom user widget buttons.

Yes, now I understand. I thought it’s because of the eye!!

Evil Eyes! :eyes:

1 Like

Hi “Everynone”,

The reason my variable “CurrentActiveButton” is of a type “Speed Button W” is because I promoted the button “SpeedButtonW” to a variable. This way it created a variable of the exact type! I don’t know why exactly!

I have tried to change the button type from “Speed Button W” into “Button” like you showed me in the photo you attached but when I do that I can no longer connect the “Speed Button W” to the variable! (photo attached).

You said something about custom user widget buttons. I have created buttons inside widgets, is this what you mean?

To be honest I still can’t make this code work!

The speed button and current active button must of the same type. Or share a base class type.