Specific print statements not working

Godot 4.6.1

Only specific print statements aren’t working, some are though. I have absolutely zero idea why, nothing is making sense.


func do_recursive(directory : DirAccess, remainingname : String) -> Material:
	var split = Array(remainingname.split("_"))
	print(split) 						#prints
	print(str("what: ", split.size())) 	#doesnt print
	print(str("what2")) 				#doesnt print
	print("what3") 						#doesnt print
	var what4 = "what4"
	print(what4) 						#doesnt print
	print(remainingname) 				#prints
	if split.size() > 1:
		if directory.dir_exists(str(split[0], "_", split[1])):
			var subdirectory = DirAccess.open(str(directory.get_current_dir(), "/", split[0], "/", split[1]))
			return do_recursive(subdirectory, remainingname.substr(split[0].length() + split[1].length() + 2))
		elif directory.dir_exists(split[0]):
			var subdirectory = DirAccess.open(str(directory.get_current_dir(), "/", split[0]))
			return do_recursive(subdirectory, remainingname.substr(split[0].length() + 1))
		else:
			var vmtname = remainingname
			vmtname = vmtname.substr(0, vmtname.length() - 5)
			vmtname = str(vmtname, ".vmt")
			return load(str(directory.get_current_dir(), "/", vmtname))
	elif split.size() == 1:
		if directory.dir_exists(split[0]):
			var subdirectory = DirAccess.open(str(directory.get_current_dir(), "/", split[0]))
			return do_recursive(subdirectory, remainingname.substr(split[0].length() + 1))
		else:
			var vmtname = remainingname
			vmtname = vmtname.substr(0, vmtname.length() - 5)
			vmtname = str(vmtname, ".vmt")
			return load(str(directory.get_current_dir(), "/", vmtname))
		
	else:
		var vmtname = remainingname
		vmtname = vmtname.substr(0, vmtname.length() - 5)
		vmtname = str(vmtname, ".vmt")
		return load(str(directory.get_current_dir(), "/", vmtname))

Are you sure you don’t have multiple versions of the script?

2 Likes

Try renaming your variable split to something that doesn’t have a naming conflict with a function. I’d guess that’s your problem.

Also, it’s not the 80s anymore, it’s ok to have easily readable, non-cryptic variable names.

3 Likes

I figured out the problem and I thought I had deleted the post. The problem was that they would only print in a terminal if I hadn’t restarted godot in long enough.