Why is my timer not working?


#1

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
		theTimer.start()
	)
)

custAttributes.add rootNode test

#2

most likely printTime gets garbage collected before the first tick event


#3

How can I stop garbage collection? bro.


#4

he linked the page

dotNet.setLifetimeControl theTimer #dotnet