Instance variable name change to Unnamed when all characters get deleted while editing name

I am not perfectly sure is this a bug or should it be feature request
But judge yourself

When i add instance variable to object
And i wanna delete name of that variable
After i delete last character it goes back to Unnamed
2024-07-23_22_18_HBoJWkHFZY_%pn

Even if i type there any name and delete all characters i hold backspace or tap it and i will create a loop when after last character is deleted it goes back to Unnamed

I think name should be allowed to be blank while i am editing the name
And go to Unnamed if i exit text editing by clicking somewhere else
But not if i delete all characters while i am editing it

Desktop version

2 Likes

That seems like a bug. I never used instance variables. I’ve always used object variables. I never understood how/why just 1 instances would /could have its own variable. It’s own value? Yes. But not it’s own variable name. That part never seemed to work even before the recent changes.

It wouldn’t surprise me if instance variables go away because you can’t seem to use them in actions or conditions. The events want an object variable not an instance. The instance panel should probably refer to object variables except for the value.

That whole system seems broken and it has for sometime. I never liked how if you create an object variable, changed the value of the variable with the instance panel then the object variable sort of turned into an instance variable because if you changed the object variable name from the object variables tab, it renamed the variable but then on the instance panel you had 2 variables, one with the old name and one with the new.

1 Like

I had same issue with understanding what instance variables are and how they work

But since i needed to explain it to users on discord i did try to look at them from different perspective
And turns out we more or less use them anyway just not trough instance panel

Look imagine we have Zombie in game actually many copies of Zombie object to fight with
Now Zombie have HP variable set to 100 (not instance variable but just variable)
And now we make event that if sword is in collision with Zombie we subtract 20 from Zombie HP variable

Now we also want event that if Zombie HP variable is below 0 we delete Zombie
BUT sometimes we go with some additional event
Like if Zombie variable HP is below 30 we tint Zombie to red
To indicate Zombies that are deeply injured

But wait a sec how come we have one variable called HP for all Zombies which we did set to 100 by default
Yet some Zombies have less than 100 while others have 100?
And we are able to reference them by their value of that HP variable even it is different from default value?

And that is how you realized you were using instance variables already
Without going for them directly

Only thing you need to realize now is that you have option to manually set different values of HP variable to Zombies via instance panel
Instead of changing it in game by damaging Zombies

With instance vars you can place things on scene editor without the need to code their id…that newbs fail to understand.
You can refer to them and their object later just with the assigned var…
From my point of view they’re very useful in many situations. a lot less code when you use them

for the Op…doesn’t it show Unnamed bcs it have to be declared(named) probably somewhere?

Issue here is not about something should show like list of my declared vars
Issue here is that if i clean out name input field it automatically go to Unnamed
Where it should stay empty as long as i have focus on that text field

Only way around it is that i need to select whole text either by Ctrl+A or double clicking next to it to highlight text

Even when you are using this forum
When you delete whole text from text box it stays empty
Imagine it would automatically show up some text if you delete everything
Kinda like when you report bug or go for feature request
You have some text there already

Imagine you delete all that to write your message and by going ctrl+a and delete and it automatically pops up back again
That is the issue here

I understand the problem. And I understand using object to variables but what I don’t understand is instance variables which are unique to instances.

Take this for example

The first 2 are object variables. The name of the 1st variable is greyed out and you can’t select or change the name. It has the default value setup in the object variable tab.

The 2nd variable is an object variable. The name is in italics because the value was changed. It’s still an object variable. If you change it’s name, it gets created as an instance variable.

The 3rd is an instance variable added with the + button. I circled it. Everything is editable plus it has the type (text, number, etc)

Only the 1st and 2nd variables show as a choice in the event sheet autocomplete. The instance variable doesn’t show and gets a red line under it if you type it manually. You can read the value if you use the Variable() or VariableString() expressions. But I can’t find a way to change the value of an instance variable.

Instance and object variables sound the same but they’re declared in different places and instance variables don’t seem to use the new variable system.

oh …ok i understand now…i’ve not noticed it, probably is related to the new system

1 Like

Let’s go back to Zombie HP variable example
And before we go i am more than sure you know that number variables by default are 0
So just keep that in mind to what is below

You want all Zombies to have HP and you want all Zombies to have it at 100
You CAN but DON’T NEED TO change it for one or few specific Zombies

NOW imagine something else
You actually want some Zombies to also have ARMOR variable for example we set it to 40 for them
But not to all of them like 5 or 7 whatever
Just so in game you could IDK add blue outline effect to your Zombies with that armor var just to indicate they have it and will require breaking down armor 1st before you can damage HP

Adding object variable with 0 by default to Zombie object could be done but makes no sense
So it would make sense to just add it with value of 40 to some Zombies on scene

And now does all of Zombies have ARMOR variable or not does not concerns you
Your only concern is if any have ARMOR variable above 0
That is why and how you would use instance variable

You do not check if something is there for everyone
But if there is something with some value for someone
Or like other example

Imagine we meet in real life
Not you and me but lets take like 30 random users from this forum
To 4 of them we attach name tag
image

And write on it Admin

Now you know these ppl are responsible for keeping our meeting civil
So you see someone punching someone else
You go to person with name tag which have written on it Admin
And you report the issue
BUT at the same time do you need all other 26 members of our meeting to have that name tag which would be empty?

You only create it for something you need to reference while NOT referencing other subjects of same group

So in other words there is no need for for any type of selection of instance variables (we could have some for declared ones) but since old system we don’t

Idea of instance variable is just having option to reference some copy of same object
By value of whatever variable it have
(I guess eventually instance vars will also need to be declared)
And now you would have it popping up in events for you to select from list
I am not 100% sure but i think this is what you are talking about
They are like kinda the name tags
You temporally attach them to something not making them part of object
Which would actually make sense so you can select them from declared list later

But in the end core purpose still stands
Where are you care about is ability to pick any object from group of objects without picking all of them or ones you do not want

Where you could simply have that HP variable declared in object var
And then make it different value for one specific copy of that object making it instance variable

Where grayed text means ALL instances of this object have this variable with this value
Italic means ALL objects have this variable but this object have different value of it making it instance variable
And normal text means NOT ALL objects have this variable but this instance have this variable with that value

So to solve your problem
You actually would need to 1st declare that var for your object
Then simply in instance panel change value of that variable
For example (looking at your screenshot)
In instance panel
Try changing objectVar1 from 0 to 2 and see what will happen

Only problem i think you are talking about that there is still a way to make instance vars in instances panel WITHOUT 1st declaring such variable for object
Hence you get red underline when you try to use it in events