Why is my timer not working?


Hey, guys, I want the 3dmax file to execute my timer when it is loaded. What should I do? Below is my code, but it does not work>.<

test = attributes example
	on load do (
		theTimer = dotNetObject "System.Windows.Forms.Timer"
		fn printTime = (print localTime)
		dotnet.addEventHandler theTimer "tick" printTime
		theTimer.interval = 1000

custAttributes.add rootNode test


most likely printTime gets garbage collected before the first tick event


How can I stop garbage collection? bro.


he linked the page

dotNet.setLifetimeControl theTimer #dotnet