コード例 #1
0
    void Find()
    {
        var allObjects = SceneObjectUtility.GetAllObjectsInScene(false);

        layerWithObjectList.Clear();

        int defaultLayer = LayerMask.NameToLayer("Default");

        foreach (var obj in allObjects)
        {
            if (obj.layer == defaultLayer)
            {
                continue;
            }

            var layerWithObj = layerWithObjectList.Find((item) => item.layer == obj.layer);

            if (layerWithObj == null)
            {
                layerWithObj = new LayerWithObject()
                {
                    layer = obj.layer
                };
                layerWithObjectList.Add(layerWithObj);
            }

            layerWithObj.objectList.Add(obj);
        }
    }
コード例 #2
0
    void Find()
    {
        var allObjects = SceneObjectUtility.GetAllObjectsInScene (false);
        layerWithObjectList.Clear ();

        int defaultLayer = LayerMask.NameToLayer ("Default");

        foreach (var obj in allObjects) {
            if (obj.layer == defaultLayer)
                continue;

            var layerWithObj = layerWithObjectList.Find ((item) => item.layer == obj.layer);

            if (layerWithObj == null) {
                layerWithObj = new LayerWithObject (){ layer = obj.layer };
                layerWithObjectList.Add (layerWithObj);
            }

            layerWithObj.objectList.Add (obj);
        }
    }