playMaker

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

kavery

  • Full Member
  • ***
  • Posts: 117
    • View Profile
Add UV Map at runtime?
« on: August 06, 2019, 08: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, 08:39:59 PM by kavery »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
  • Official Playmaker Support
    • View Profile
Re: Add UV Map at runtime?
« Reply #1 on: August 07, 2019, 11:07:21 PM »
Hi,

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


Bye,

 Jean

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 743
    • View Profile
Re: Add UV Map at runtime?
« Reply #2 on: August 08, 2019, 05: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, 05:28:38 AM by tcmeric »

kavery

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