playMaker

Author Topic: Add UV Map at runtime?  (Read 1323 times)

kavery

  • Full Member
  • ***
  • Posts: 149
Add UV Map at runtime?
« on: August 06, 2019, 11:37:28 PM »
Is it possible to add a UV map during runtime, like a basic box map or planar map?

In my situation a user imports an .fbx, and applies materials to each part. Would be great to add a base UV map when the imported file lacks one.
« Last Edit: August 06, 2019, 11:39:59 PM by kavery »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Add UV Map at runtime?
« Reply #1 on: August 08, 2019, 02:07:21 AM »
Hi,

 It's possible, but not without heavy, heavy, very heavy coding :)


Bye,

 Jean

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Add UV Map at runtime?
« Reply #2 on: August 08, 2019, 08:25:59 AM »
I wonder if it is possible and easier to do it, by using ProBuilder 4s runtime API. I dont think there is much documentation there, but it should be able to create UVs. (Of course, this still require some coding, but potentially a lot less).

Edit: In this example they take a normal obj and probuilderize it. Make an adjustment and then rebuild it. On the rebuild process, it should regenerate the Uvs.

https://github.com/Unity-Technologies/ProBuilder-API-Examples/blob/master/Runtime/Convert%20Mesh%20to%20Editable/MakePrimitiveEditable.cs
« Last Edit: August 08, 2019, 08:28:38 AM by tcmeric »

kavery

  • Full Member
  • ***
  • Posts: 149
Re: Add UV Map at runtime?
« Reply #3 on: August 08, 2019, 06:29:51 PM »
Oh wow, I'll try this. Thanks!