So the app is used to display tasks in a calendar. You can click W or S to move forward or backward. Each task has a click button with an alert function attached. Here is a playground link: http://www.babylonjs-playground.com/#1ZH86G#2
The problem I am facing is render optimization. Since there will be tons of tasks to render, I want to use clone function or createInstance function as suggested from documents. But these 2 functions don't work when I want the cloned object to have the click control.
In the playground code: (line 45, createTasks)
1. If you call attachTaskInfoWithFunction(task) upon each cloned task object, it works. But it has a significant performance issue when you want to render more than 400 task meshes. (I'm just rendering 40, you can change the task number on the top)
2. If you call attachTaskInfoWithFunction(task) upon the originalTask and make clones from it, you will lose the click event function.
3. If you call attachTaskInfoWithFunction(task) upon the originalTask and call createInstance on it, you will lose the click event function.
I want to ask with Babylon GUI, is it possible to call clone or createInstance on mesh object while still keep the texture with button click control?
If not, is there any other way to optimize if there are tons of objects to render.
Thanks