Alexis Sánchez

Day 09-10 Smeared

class MyClass(object):
	def __init__(self) -> None:
		self.frame_count = 0
		self.max_count = 1000

	def start(self) -> None:
		self.slate_post_tick_handle = unreal.register_slate_post_tick_callback(self.tick)
		self.frame_count = 0

	def tick(self, delta_time: float) -> None:
		print(self.frame_count)
		self.frame_count += 1
		if self.frame_count >= self.max_count:
			unreal.unregister_slate_post_tick_callback(self.slate_post_tick_handle)

test = MyClass()
test.start()

Using cast to fix type hint errors

The docstrings for the stub file say what each function should return, so we can use the cast(type, variable) syntax from the typing module to tell pylance what to expect.

But why go through this effort? Well if we do this, then we know what each variable is, and if we know what each variable is then pylance can tell us what each variable can do.

test 1

hola hola hola