thats works in editoorr but not on webgll build why? void FindAllObjectsWithComponent()…
- User
thats works in editoorr
but not on webgll build
why?
void FindAllObjectsWithComponent() { // Get all root GameObjects in the active scene GameObject[] rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
codeforeach (GameObject rootObject in rootObjects) { // Recursively find all objects with the SpawnPointScript component FindObjectsWithComponentRecursively(rootObject); } } void FindObjectsWithComponentRecursively(GameObject obj) { // Check if the current object has the desired component SpawnPointScript component = obj.GetComponent<SpawnPointScript>(); if (component != null) { spawnPoints.Add(component); } // Traverse each child object foreach (Transform child in obj.transform) { FindObjectsWithComponentRecursively(child.gameObject); } } private void Awake() { if (spawnPoints.Count == 0) { FindAllObjectsWithComponent(); } } - Assistant
- User
i need new vodis for savings prefs like
i ahve lsit of points i need in that voids for save and load 1 int for spawn points
i need short answerr, veryy
also i need only voids and changes answerr short public class ManageParkourPoint : MonoBehaviour { public List spawnPoints = new List(); public int currentSpawnIndex = 0; public int nextSpawnIndex = 0; public AudioClip bruh; public AudioClip yeah; public int pointsReached = 0; public FIMSpace.FProceduralAnimation.DEMO_LegsAnim_Mover local;
- Assistant
Here are the methods for saving and loading an integer (like
pointsReached) usingPlayerPrefs:csharppublic void SaveSpawnPointIndex() { PlayerPrefs.SetInt("SpawnPointIndex", currentSpawnIndex); PlayerPrefs.Save(); } public void LoadSpawnPointIndex() { if (PlayerPrefs.HasKey("SpawnPointIndex")) { currentSpawnIndex = PlayerPrefs.GetInt("SpawnPointIndex"); } }Call these methods whenever you need to save or load the spawn point index.