SHARE
TWEET

Untitled

a guest Apr 21st, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3.  
  4. /// A concrete subclass of the Unity UI `Graphic` class that just skips drawing.
  5. /// Useful for providing a raycast target without actually drawing anything.
  6. public class RaycastTarget : Graphic
  7. {
  8.     public override void SetMaterialDirty() { return; }
  9.     public override void SetVerticesDirty() { return; }
  10.  
  11.     /// Probably not necessary since the chain of calls `Rebuild()`->`UpdateGeometry()`->`DoMeshGeneration()`->`OnPopulateMesh()` won't happen; so here really just as a fail-safe.
  12.     protected override void OnPopulateMesh(VertexHelper vh)
  13.     {
  14.         vh.Clear();
  15.         return;
  16.     }
  17. }
RAW Paste Data
Top