2
0
Fork 0
mirror of https://github.com/GTA-ASM/SanAndreasUnity synced 2025-02-24 11:17:11 +00:00

fix for not displaying first enex location

This commit is contained in:
in0finite 2019-10-26 18:05:35 +02:00
parent 362241aace
commit 3367c59b45
2 changed files with 10 additions and 2 deletions
Assets/Scripts

View file

@ -83,7 +83,7 @@ namespace SanAndreasUnity.UI {
{
var obj = GameObject.Find("Player Spawns");
if (obj)
return obj.GetComponentsInChildren<Transform> ();
return obj.transform.GetFirstLevelChildren().ToArray();
return new Transform[0];
}
@ -104,7 +104,7 @@ namespace SanAndreasUnity.UI {
}
for (int i = 1; i < _spawns.Count; i++)
for (int i = 0; i < _spawns.Count; i++)
{
var spawnLocation = _spawns [i];

View file

@ -209,6 +209,14 @@ namespace SanAndreasUnity.Utilities
}
}
public static IEnumerable<Transform> GetFirstLevelChildren(this Transform tr)
{
for (int i = 0; i < tr.childCount; i++)
{
yield return tr.GetChild(i);
}
}
public static void SetY(this Transform t, float yPos) {
Vector3 pos = t.position;
pos.y = yPos;