0 votes

Hello, everyone

For example, my instance is called @Instance@ID.

Is there a way to check if half of the name matches, then the result is true.

I think also to add in autoload, but there will be many types of instances.

What's your suggestion?

in Engine by (18 points)

2 Answers

+2 votes

You can use the String functions


If the string begins or end with the same string each time.

If it doesn't, then check out the RegEx class, in particular capturing groups to check if a string matches the regular expression and capturing sub-strings for id's and such.

by (212 points)
0 votes

Also, if you just want to know your instance name has the word Instance in it, you can use in

Something like:

if "Instance" in object.name:
by (1,921 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.