Unwrapping.GenerateSecondaryUVSet not found in current context
Asked Answered
G

2

0

I have generated a mesh in a C# script. When I try to use

Unwrapping.GenerateSecondaryUVSet( mesh );

I get an error:

CS0103: The name `Unwrapping' does not exist in the current context

In the script I am calling:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

Am I missing something?

Georgeta answered 28/11, 2023 at 9:34 Comment(0)
G
0

I solved this by adding using UnityEditor;

using UnityEngine;
using UnityEditor;
  
// ...
  
Unwrapping.GenerateSecondaryUVSet(mesh);

because Unwrapping class is part of UnityEditor:

Georgeta answered 28/11, 2023 at 9:31 Comment(0)
M
0

I also have this bug but have added previously indicated using lines
I compile for Hololens2

Mosher answered 28/11, 2023 at 8:3 Comment(1)

https://docs.unity3d.com/ScriptReference/Unwrapping.html UnityEditor.Unwrapping is available in editor only. Referencing it in a runtime code will throw build errors.

Sorrell

© 2022 - 2025 — McMap. All rights reserved.