Debug.log() or print() stopped working... but the rest of the code still run?

I was coding and when I implemented the findExtremum() command, debug log and print stopped working altogether, despite working previously. I’m completely puzzled, I restarted unity, commented huge chunk of code, spammed them everywhere to see if it wasn’t something that break at some point. It’s just mysterious …

I’m using unity 2018.1.0b13 with script inspector 3

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class convexTest : MonoBehaviour {
    Vector3[] vertlist;
    Vector3 centroid;
    ArrayList discard;
    List<Vector3> SupportVert;
   
    Vector3
        minX,maxX,
        minY,maxY,
        minZ,maxZ;
   
    void Start () {Debug.Log("loop");
        vertlist = new Vector3[100];
        discard = new ArrayList();
        this.SupportVert = new List<Vector3>();
        for(int i =0; i<vertlist.Length;i++){
            vertlist[i] = Random.insideUnitSphere;
            this.SupportVert.Add( vertlist[i]);
            print (vertlist[i]);}
        Debug.Log("loop");
        findSupportVert();Debug.Log("loop");
        showdebugresult();Debug.Log("loop");
        FindExtremum();Debug.Log("loop");
        print(minX);
        print(maxX);
        print(minY);
        print(maxY);
        print(minZ);
        print(maxZ);
        //Debug.Break()
    }
           
    void findSupportVert () {
        //compute centroid position
        foreach (Vector3 v in vertlist){this.centroid += v;}
        this.centroid /= vertlist.Length;
        //initialize loop
        Vector3 support = new Vector3();
        float max = float.Epsilon;
       
        //iterate points to get the support point
        foreach (Vector3 v in vertlist){
            Vector3 normalDirection =(v - this.centroid).normalized;//vector= end - start
           
            //check all other points to find support
            max = float.Epsilon;
            foreach (Vector3 t in this.SupportVert){
                Vector3 compared= t - this.centroid;
                float dot = Vector3.Dot (compared,normalDirection);
                if (dot > max) {
                    max = dot;
                    support = t;if (t == v) print("ding!");print ("maxi!");}}
                   
            //after iteration, if current is not support, discard
           if (support != v) {discard.Add (v);this.SupportVert.Remove(v);
            print ("discard:"+v);}
            if (support == v) {print ("self");}}
               
        print ("discard count:"+discard.Count);}
       
    void FindExtremum(){
        minX = this.SupportVert[0];
        maxX = this.SupportVert[0];
       
        minY = this.SupportVert[0];
        maxY = this.SupportVert[0];
       
        minZ = this.SupportVert[0];
        maxZ = this.SupportVert[0];
        print("loop");Debug.Log("loop");
        foreach (Vector3 v in this.SupportVert){
            if (v.x > maxX.x) maxX = v; if (v.x < minX.x) minX = v;
            if (v.y > maxY.y) maxY = v; if (v.y < minY.y) minY = v;
            if (v.z > maxZ.z) maxZ = v; if (v.z < minZ.z) minZ = v;}}
       
    void showdebugresult(){
        foreach (Vector3 v in this.SupportVert){
            Debug.DrawRay(this.centroid, v, Color.white);}
        foreach (Vector3 v in this.discard){
            Debug.DrawRay(this.centroid, v, Color.red);}
        DrawDebugCube(minX,Color.blue);
        DrawDebugCube(maxX,Color.blue);
        DrawDebugCube(minY,Color.blue);
        DrawDebugCube(maxY,Color.blue);
        DrawDebugCube(minZ,Color.blue);
        DrawDebugCube(maxZ,Color.blue);
    }
       
    void DrawDebugCube(Vector3 pos, Color color){
        float size = 0.1f;
        Vector3 up        = pos + Vector3.up        *size;
        Vector3 down    = pos + Vector3.down    *size;
        Vector3 right    = pos + Vector3.right    *size;
        Vector3 left    = pos + Vector3.left    *size;
        Vector3 forward    = pos + Vector3.forward    *size;
        Vector3 back    = pos + Vector3.back    *size;
       
        Debug.DrawLine(up,down,        color);
        Debug.DrawLine(right,left,    color);
        Debug.DrawLine(forward,back,color);}
       
}

Unity 2018.1 is officially released now.

It’s been downloading for a few days already, will update to see if it’s related.

Pretty sure it doesn’t work in the non beta version too

Should I file a bug?

You should try clicking the little button on the right side that has the number ‘185’ i think from the photo.
See if that helps :wink:

2 Likes

(ノಠ益ಠ)ノ彡┻━┻
Thanx!

:slight_smile: You’re welcome.