Find object by prefab path?
Hi,

I'm trying to find all the wooden external gates on my server:

foreach(var GateToRemove in GameObject.FindObjectsOfType<Door>())
{
GateToRemove.Kill();
}​

 

This doesn't work and doesn't seem to be right way as it would find every single Door and not only the gates.
I can't figure it out, how can I get this done?

Thank you.

Add this to the first line:

.Where(x => x.name.Contains("wall.external.high.wood.prefab"))
Sheraf
It worked, thank you.

do you know if there is a way to the same using the ID found on this page https://umod.org/documentation/games/rust/definitions#items ?
thanks.

Item is only thing that is in your inventory. When its palced in the world its "entity"

You might find the Prefab Sniffer plugin useful. That's what I used to get the "wall.external.high.wood.prefab"​ part.  Not sure if there is any up-to-date prefab list online.