NGUI SetCrosshairs

devomage

Member
I converted the CrosshairsMonitor.cs script to NGUI and found that SetCrosshairs in OnAttachCharacter causes a big problem if it doesnt have a valid RectTransform.

I also had to switch in Update:

C#:
// uGUI
var crosshairsRay = m_Camera.ScreenPointToRay(m_CenterRectTransform.position);

// NGUI
var crosshairsRay = m_Camera.ViewportPointToRay(new Vector3(0.5f,0.5f,0));

What will these changes mean (and how to properly fix them) for the FirstPerson and ThirdPerson scripts. Looks like uGUI is embedded... specifically, the use of RectTransform.

I'm not a huge fan of NGUI, but do not like being stuck with uGUI.
 
I hope to eventually have an abstract layer that works with the UI, similar to how the input is abstracted.
 
Top