I'm looking to make a trash can with udon

I’ve watched the video from (Vowgan VR) on how to make a spawner but now I’m looking to make a trash so my players can remove the objects and not cluder the world.

You’re probably looking for Destroy, which is essentially the opposite of Instantiate.

A similar option is just to use SetActive on the gameobject to deactivate it.

Could you show me and example in udon I’m not great with this system

Here is a simple example using udon sharp. (since I’m not very familiar with the graph)

public class SlefDeletingObject: UdonSharpBehaviour
{
    public void OnTriggerEnter(Collider other) {
        if (other.gameObject.name.Contains("Trash Can")){
            Destroy(gameObject);
        }
    }
}

You would add this to the item you want to be deleted. Lets say a Coffee Cup.

image

When the Coffee Cup touches an object that has a name that contains “Trash Can” it will delete its self.

Just make sure the Trash Can object has a collider, and has “Is Trigger” checked.

Is there anyone that can show that in udon Graph I don’t have udon sharp.

Yo I know this is old but here’s a solution that should work for you… this returns the items into a pool BUT you can delete everything after Set Name and just do UnityGameObjectDestroy to kill that item if you like.