- Home /
Is there a more efficient way to pass two integers via "SendMessage" than using a Vector2 Struct?
Using sendmessage to do such a close to 1000 times over the course of a second; just trying to prevent lag here.
If your code is in update, it will run as much times as your framerate per second. In any case, if both variables you want to pass are integers, why not pass an array?
It's actually my way of pathfinding. When something on the field changes; a command is sent to the exit; the exit raycasts to tell the spaces around it that they are 1 space from the exit. Those spaces raycast to adjacent ones to tell them that they are 2 spaces from the exit and so on until it reaches the other side o the field. After waiting for all the cells around a particular cell to update; each cell will raycast again, in order to figure out which of the cells surrounding it is closer to the exit that it's own distance value and after that, any enemy AI that passes into the block knows to go in the direction it recorded. Whole process takes about 5 seconds; really like to get that down.
Answer by flaviusxvii · Feb 21, 2013 at 08:50 PM
How many objects need the information from this message? It would be better to find the objects who are meant to receive the information and pass the int directly to them.
Your answer
Follow this Question
Related Questions
How should I organize this money system? 1 Answer
Reset my (public)integers on GUI? 0 Answers
C# Point structure 1 Answer
Why Rect is drawn top-left and Vector2 goes from bottom-right 1 Answer
Problem with mooving sprites 1 Answer