remove specific gameobject in list variable

VRod 2 months ago in Game Creator updated by Marti (Lead Developer) 2 months ago 6

I have a List Variable that gets populated during runtime.  Gameobjects get placed inside.  During a triggered event, I wish to remove a specific gameobject. 

Example: I am keeping track of which objects are on the floor, and which objects are on the table. The user can pickup an object and move it from one place or another at anytime.  I can add the gameobject easily to it's new list, but cannot remove it from it's old list.

How can I go about this?


Unity version:
Game Creator version:


After using any "get" operation on a List Variables, the iterator will point to that index. So, all you need to do is to use the Remove From List Variables Action and set the Select field to "Current" (which is the iterator, pointing to the last used element on the list).

Condition : List variable contains object. drag your list here and the object you want to check

Action: remove from list and add your list here and select current in the drop down. 


That is what I have setup, and thought it would work. No dice.

I will keep trying out some things tomorrow.  Maybe because I am using an ïnvoker"?

I know that it is searching for the proper item. I have a debug message confirming that the invoker is the object I think it is.

That object is definitely in the List variable. 


If (the List) List contains invoker

then Remove (the List) current. (Note that the list in the Remove list heading is not filled out.  Is this a bug?)

No matter what, I could not get it to work (for me).

In the end, my solution was to simply, Clear then Build the List Variable immediately before I needed it.


Some specific things are a bit more difficult to do using the visual scripting language we build and some others are much easier. This is one of the cases where it might be a bit cumbersome.

I've added this to our list of things to assess for the future, as I believe it's important to be able to find a specific object inside a list (although lookups can get expensive!).