- Home /
Can't use SortedSet type for sorted RaycastAll
I would want to implement a system for my bullets to pass through walls. I need to use the SortedSet type to make a system similar to this one: (see Scott Kovacs' answer)
http://answers.unity3d.com/questions/22261/sorting-builtin-arrays.html
I included those:
using UnityEngine; using System; using System.Collections; using System.Collections.Generic;
and I initialized my SortedSet like that:
`SortedSet raycastResults = new SortedSet();`
but it gave me an error, saying it couldn't recognize the SortedSet type.
`error CS0246: The type or namespace name `SortedSet`1' could not be found. Are you missing a using directive or an assembly reference?`
isn't SortedSet supposed to be defined in System.Collections.Generic? That's what I can read everywhere. Am I missing something?
Answer by hvilela · Oct 20, 2012 at 10:01 PM
If you check the Mono Compatibility Page you'll see that Unity do not include SortedSet. It does include SortedList, so you can use it instead.
If I use subclasses where I want to use my SortedSet, is it possible to use the "standard" System namespace and not the Unity one that limits me to Lists?