TC_ProjectPreview.cs 507 B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace TerrainComposer2
  4. {
  5. [ExecuteInEditMode]
  6. public class TC_ProjectPreview : MonoBehaviour
  7. {
  8. static public TC_ProjectPreview instance;
  9. public Material matProjector;
  10. private void Awake()
  11. {
  12. instance = this;
  13. }
  14. private void OnEnable()
  15. {
  16. instance = this;
  17. }
  18. private void OnDestroy()
  19. {
  20. instance = null;
  21. }
  22. public void SetPreview(TC_ItemBehaviour item)
  23. {
  24. matProjector.SetTexture("_MainTex", item.rtDisplay);
  25. }
  26. }
  27. }