Quantcast
Channel: Questions in topic: "log"
Viewing all articles
Browse latest Browse all 235

Debug.Log not outputting in all scripts

$
0
0
My Debug.Log() function is not showing in all of my scripts, and yes, most of them are attached to gameObjects. I can't seem to get the reason why it doesn't show up. I also have the console debugging enabled, and I put Debug.Log("AAA") in the update function, without any if statements, while statements, or for statements around it. Here is an example: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { [HideInInspector] public static FloorBar[] floorBars; public static Vector3 pos; public Vector2Int floorBarSize; public static GameObject go; public void DefineVars(FloorBar[] floorBarsA) { floorBars = floorBarsA; pos = new Vector3(); go = gameObject; SetPos( new Vector2(0,0)); gameObject.SetActive(true); } public void SetPos(Vector2 desiredPos) { int posIndex = PosToIndex(desiredPos); Debug.Log(floorBars[posIndex].gm.transform.localScale.y); Vector3 posToAssign = new Vector3((int)floorBars[posIndex].pos.x, (floorBars[posIndex].gm.transform.localScale.y / 2 + 0.6f), (int)floorBars[posIndex].pos.z); if (posToAssign.y > pos.y && (posToAssign.x != pos.x || posToAssign.z != pos.z)) { gameObject.SetActive(false); UIScript.stSetCanvasOffset(UIScript.canvasList[0], new Vector2(-1, 0)); } pos = posToAssign; gameObject.transform.position = pos; } public static void Restart() { for(int i = 0; i < floorBars.Length; i++) { floorBars[i].nextHeight = 1; floorBars[i].CalcHeight(floorBars[i].nextHeight, 1); } pos = new Vector3((int)floorBars[0].pos.x, (floorBars[0].gm.transform.localScale.y / 2 + 0.6f), (int)floorBars[0].pos.z); go.SetActive(true); } public void Update() { Debug.Log("AAA"); <--- Here is my Debug.Log if (!UIScript.paused) { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { if (!IsOutOfBounds(pos + new Vector3(0, 0, 1))) { SetPos(new Vector2(pos.x, pos.z + 1)); } } if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { if (!IsOutOfBounds(pos + new Vector3(-1, 0, 0))) { SetPos(new Vector2(pos.x - 1, pos.z)); } } if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { if (!IsOutOfBounds(pos + new Vector3(0, 0, -1))) { SetPos(new Vector2(pos.x, pos.z - 1)); } } if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { if (!IsOutOfBounds(pos + new Vector3(1, 0, 0))) { SetPos(new Vector2(pos.x + 1, pos.z)); } } SetPos(new Vector2(pos.x, pos.z)); } } public bool IsOutOfBounds(Vector3 desiredPos) { return desiredPos.x < floorBars[0].gm.transform.position.x || desiredPos.z < floorBars[0].gm.transform.position.z || desiredPos.x > floorBars[floorBars.Length - 1].gm.transform.position.x || desiredPos.z > floorBars[floorBars.Length - 1].gm.transform.position.z; } public int PosToIndex(Vector2 pos) { return (int)pos.y * floorBarSize.x + (int)pos.x; } }

Viewing all articles
Browse latest Browse all 235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>