How do I…
I have working code that creates x instances of an object and lets me click one of those (conditions used: left mouse button released and cursor on object).
When I do exactly the same in an extension, it does not recognize that the cursor touches the object. The object is introduced as an object parameter to the expansion. When I remove the cursor/touch condition, I see the log entry. So it must be the cursor/touch condition not acting correctly.
What is the expected result
I expect the cursor/touch condition to recognize when the cursor touches the object.
What is the actual result
The cursor touching the object is not recognized
Related screenshots
does not work
I’m not allowed to upload a second screenshot as a new user, sorry!
That’s strange because it works for me, are you sure it’s not the DrawDie variable interfering? Could there maybe be a problem with the object itself?
I‘m sure that the variable is not the problem, for two reasons:
- I checked the value with the debugger and it is 2, as expected
- The code works if I remove the on touch condition
The object is fine, too, as is t is the exact same object that works if I don’t use an extension, not even a replication, but literally the same.
Can you post a screenshot of the function being used? It could be that the object isn’t being made available bc of a condition in the other part.
Here’s a screenshot of everything that happens until the problem:
Is this an extension or main code. If it’s an extension then is the function being triggered on every frame from the scene?
It is an extension that’s triggered by the push of a button.
If it’s only running when a button is pressed then I can’t see how the last events can run more than once per button click even then the button would have to be the object or both items would have to be clicked or touched at the same time. You might need to split this into 2 functions.
One function to shuffle that runs when the button is clicked and one that runs in every frame while the game is being played and input is desired.
Hi @Keith_1357,
Thanks for your reply, this was very helpful. I thought that everything within the function runs once when it has been triggered once. But in fact, it only runs as long as the condition for the call of the function is true. This forced me to adjust the structure and made it less compact, but it works now! 
1 Like