Entity's coords

Discussion in 'Rust Development' started by Equiment, Feb 22, 2016.

  1. Hi ;)

    How can i find entity's coords by entity name? For example : now i need to find all mining quarries
     
  2. Calytic

    Calytic Community Admin Community Mod

    Code:
    BaseEntity[] entities = UnityEngine.Object.FindObjectsOfType<BaseEntity>();
    foreach (BaseEntity entity in entities)
    {
        if (entity.name.Contains("someEntityName"))
        {
            Debug.Log(entity.transform.position);
            // something clever here
        }
    }
    Since you mentioned the mining quarry specifically, you could also try..
    Code:
    MiningQuarry[] quarries = UnityEngine.Object.FindObjectsOfType<MiningQuarry>();
    foreach (MiningQuarry quarry in quarries)
    {
        Debug.Log(quarry.transform.position);
        // something clever here
    }
     
  3. my thanks :)