... give buttons different colors - it always changes every button :/

Hello!
There’s got to be a way to change this setting. I want to use the same type of button (the black decorated button) several times but in different colors. Whenever I change the color of one, it changes the color of all. How do I change this?
Thanks a bunch!
Lou

1 Like

What you are looking for are instance variables
Look i clicked on that block and added instance variable set it to number and called ID and set it to 0

Where here i clicked on another copy of same exact object and i also added number variable to it and called it ID but here i set it to 1

Now i can either change it’s animation to something or in event use condition
Variable ID of object Block is equal to 1

And all actions i shove in there will only apply to Block object with ID variable equal to 1
I could for example tint it or change it animation or whatever

1 Like

Thanks so much! I’m not sure we mean the same thing. I want my clickable text buttons to have different colours permanently. So it should look like this:

But it immediately changes to this in the preview:


Changing the instance variable did not do anything, I think that’s because we meant different things maybe?
Thank you for your help!
Lou

Nah we meant same thing you just did not do what i told you to do

As you see i have 3 copies of same object called Platform
I give them ID variable 0 1 and 2

One with ID variable 0 is unchanged
One with ID variable 1 was tinted via events

One with ID variable 2 have it’s animation changed to 1 in object properties panel

And now even so i have 3 copies of same object all of them look different and i can do with them whatever i want without affecting others

The buttons (custom controls AKA prefab objects) add custom textures although if you add another button either through the add object screen or by duplicating an existing button they don’t seem to overwrite the existing images or rename and add new images. So, all of the objects use the same images for the button states.

You can choose the images that are used for each state. The easiest way would be to add a button then make copies of the images and assign them to the other button. Or choose a different button design when you add a button.

I don’t believe you can change the tint of buttons because they are a collection of other objects. In the case of buttons, they’re a combination of panel sprite objects and a text object.

I tried using the color replace object filter and it seems to work similar to the tint. So, if you assign the object variable named something like ID, you can pick the object and assign the replace with color on an object level.

If there truly isn’t a tint actions, I would also recommend that you post a request for one. Along with any other options that you believe are missing. (one request per post) Workarounds are nice but nothing can replace a built-in feature.

Just learning

So…
Are they saying they want
1 object (let’s call it “same type of button”)
To be used multiple times but in different colors
And that when they change this Object 1 (“same type of button”)

Then it’ll change the color of All other objects of this type (like Object 2, etc)
To a different color like blue

Finished reading the guide on this site ‘getting started’
Think this is related Custom Objects ("prefabs") - GDevelop documentation

When you add a button, it adds the selected theme. With the images for the idle, hovered and press.

This is how they look in the resources.
image
.

If you make a copy of the button, it copies all of the settings including the names of the images for the states. It doesn’t copy the actual images or resources. So, if you change one image, it shows on all of the buttons. It points to the resource. It doesn’t contain it.

If you add another button from the [add a new object] it adds another button but if another button of that theme already exists, it uses the same resource name but it doesn’t overwrite the existing images.

You can edit the existing images, choose a different image or delete the current resource name and use Piskel to create a new one.

To keep the format and size of the current button then you can make a copy of the actual image file and then choose that file. You can do it with the OS or save it under a different name in Piskel. Then any button using that resource would look like that one. You would need to edit all 3 states.

It’s not an ideal way of doing things. It would help if suggestions were posted for a better way such as tint or the ability to add buttons with the default images.

I went on. IDK if I made it clearer. The main thing is when a button is added it includes images for the 3 states. If a button of that type or theme exists then it uses the same resource names but it doesn’t overwrite the existing resources. So, if you change black to red and add a black button then it will also be red unless you save the images under different resource names. That’s the key. For different style buttons, they need to have different resources.

image

image

The buttons themselves can look like whatever image you use.

Button (‘object’ thing)

So when you add a button (‘button A’), (‘object’)
It adds 3 button images/artwork (so… when you add 1 ‘object’, its adding ‘3 extra objects’… ok… that makes sense… i guess…)

If you make a copy (‘instance’ thing) of this main ‘button’, let’s call it ‘button A
It copies all stuff…
But, it doesnt copy the ‘actual images’ (guess that means the artwork of the original ‘object’ button A)
or resources (the other 3 artworks)

So that means it doesn’t actually copy everything of an ‘object’ or artwork…

Hopefully that isn’t the same for all artworks (‘objects’) and copies (‘instances’) of those artworks
That would be such an incredible mess and so confusing for anyone to understand

So ‘instances’ do not actually copy everything from an ‘object’… thought site said that but have to look at my notes, that is on this forum site

So if you change ‘one image’ (i guess that’s talking about 1 of 4 artworks and images that there are right now, whichever one it is, but we don’t need to know which one

And I guess you’re changing the color (or whatever else) of that 1 artwork

‘It points to the resource. It doesn’t contain it.’
Huh… so something is ‘pointing’ or using one of the 3 other artworks (since the artwork are the ‘resources’
And something doesnt have something (else, i guess… )

If you add another button (let’;s call that button B so things are actually clear and understandable for everyone)

but if another button of that theme already exists

Another button? So we have yet another button? Ok let’s call that another button button C
Or was this about button B

of that theme already exists

Which artwork? Of button A?

Am too confused right now to continue the rest
But all this sounds like some technology or computer or code problem for whoever does this technology and computer stuff
And that this technology maybe could’ve been designed or made alot better, hopefully many years from now
I don’t know if making this better would take many years since only smart geek people would know that since I guess those are the smart people, but maybe not when it comes to communication or explaining technology stuff

Hopefully this site or whoever made this gdevelop thing explained this somewhere. This could be why nobody knows or understands how to do any of this stuff
It’s never explained well anywhere in ways that anyone would understand, but hopefully it was explained somewhere well and in detail - and also very clearly – and also very consistently

This sounds like a super super super advance topic so i guess ill look back or understand this i guess in the far off future

Hopefully whoever asked this question about whatever its about understands how to do whatever they’re doing now