Hello! I have been fidgeting around with this all night and have pretty much exhausted my thoughts on the matter, as well as any information I thought I could find here.
I am designing a basic tile based 2D game-a-ma-bob, and to make designing levels for it less psychosis inducing, I am creating a little something for the Editor. The main part of this Editor script involves painting a texture onto the tiles, so the designer doesn’t have to go piecemeal, clicking every single tile and manually selecting their texture; with a few thousand tiles, that could get a tad tiresome. Simply select the texture to paint on, track the mouse over the 3D port, and report the objects it traces over. Easy, right?
Well, I thought so too, at first. It seems all the methods I have tried work only during Runtime. For example, while I did find methods of getting an accurate cursor position, I have yet to find a way to get accurate click events/inputs, and none of the unit conversions work to translate the mouse coords to world coords (no active cameras due to not being in runtime, for example). I literally went through every related class I could think of to find possible solutions, and couldn’t seem to whip one up.
While I obviously missed something, I know at least one of you can help me figure this out!
Is there any trick to working with the mouse in the Editor? A way to get good XY coordinates for finding world objects, a way to detect the apparently indetectable left click (Mouse is technically outside the custom window), and of course a way to prevent the mouse from selecting everything it traces over? If anyone can help steer me to the right classes, functions, and techniques, I would be quite grateful!