0 votes

I have a list of values. Let say: [1, 2, 2, 5, 5, 5, 7]
And I need to delete from it all reoccurring values. So that the result should be [1, 2, 5, 7]
How do I do that?

in Engine by (87 points)

1 Answer

0 votes
Best answer
func array_unique(array: Array) -> Array:
    var unique: Array = []

    for item in array:
        if not unique.has(item):
            unique.append(item)

    return unique
by (1,650 points)
selected by
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 Frequently asked questions and 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 [email protected] with your username.