The Swartz-Manning’s first exhibit will provide a detailed history of Aaron Swartz Day. https://www.aaronswartzday.org/vr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SetCustomUnwrapParams.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Set new ProBuilder objects to use special UV2 unwrap params.
  3. */
  4. // Uncomment this line to enable this script.
  5. // #define PROBUILDER_API_EXAMPLE
  6. #if PROBUILDER_API_EXAMPLE
  7. using UnityEngine;
  8. using UnityEditor;
  9. using System.Collections;
  10. using ProBuilder2.Common;
  11. using ProBuilder2.EditorCommon;
  12. [InitializeOnLoad]
  13. public class SetUnwrapParams : Editor
  14. {
  15. /**
  16. * Static constructor is called and subscribes to the OnProBuilderObjectCreated delegate.
  17. */
  18. static SetUnwrapParams()
  19. {
  20. pb_EditorUtility.AddOnObjectCreatedListener(OnProBuilderObjectCreated);
  21. }
  22. ~SetUnwrapParams()
  23. {
  24. pb_EditorUtility.RemoveOnObjectCreatedListener(OnProBuilderObjectCreated);
  25. }
  26. /**
  27. * When a new object is created this function is called with a reference to the pb_Object
  28. * last built.
  29. */
  30. static void OnProBuilderObjectCreated(pb_Object pb)
  31. {
  32. pb_UnwrapParameters up = pb.unwrapParameters;
  33. up.hardAngle = 88f; // range: 1f, 180f
  34. up.packMargin = 15f; // range: 1f, 64f
  35. up.angleError = 30f; // range: 1f, 75f
  36. up.areaError = 15f; // range: 1f, 75f
  37. }
  38. }
  39. #endif