Skip to content

Instantly share code, notes, and snippets.

NPatch

Block or report user

Report or block NPatch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NPatch
NPatch / CustomEditorDrawerPropertySerializationScheme.txt
Last active Dec 9, 2016
Custom Editor/Drawer property serialization per instance
View CustomEditorDrawerPropertySerializationScheme.txt
At this point, creating custom editor scripts or custom drawers for specific classes and having the ability to keep editor/drawer only properties serialized is to create a helper class or helper fields inside the class we are trying to draw , wrapped with
#if UNITY_EDITOR
#endif
and grabbing it as SerializedProperties inside the custom editor/drawer script and at the end of the process, write back all changes.
If we have lots of classes around and we want to do fancy stuff and have drawers/editors for many of them and having them blend
with eachother to achieve reuse etc, it becomes quite combersome towards the size of the codebase just for editor stuff.
The problem currently is that we can't differentiate between instances of a single type. If we could differentiate we would be
able to pinpoint any such property , eg a foldout in a drawer for X type, by querying some form of database(be it an actual database or an asset or a dictionary in memory) about the properties for that instance and then for the fie
@NPatch
NPatch / 2way_circ_index_trav_without_ifs
Last active Sep 1, 2016
TwoWay Circular Index Traversal in Buffers without IF statements
View 2way_circ_index_trav_without_ifs
Lets say we have a one dimensional List with objects/primitives/whatever and inside that one dimensional List
,there are several non fixed length one dimensional Lists.
Say we know the starting index and length of each of the sublists and we want to have circular traversal with wraparound
using the same index for all lists and whenever we want, we change the sublist, we can still traverse without ifs and circular.
Finally, we also want to be able to traverse both forwards and backwards.
An example:
SuperList(0,16) => where first param is start_index and second param is length
View Win32CurrentDisplayOrientation.cpp
//MUST have a valid window created to obtain a correct HMONITOR from the window's hWnd. Console windows don't give a correct HMONITOR.
//Neither did it work by calling GetConsoleWindow to get a hWnd for a console application and querying the HMONITOR from the console hWnd.
//Monitor from Window
HMONITOR monitor_handle = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFOEX monitor_info;
monitor_info.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(monitor_handle, &monitor_info);
You can’t perform that action at this time.