- Home /
Question by
Stardog · Jan 06, 2012 at 08:00 PM ·
multiplefbximportermodelimporter
Changing FBXImporter settings on selected models
I want to change the Scale/Generate Colliders/Materials Generation/Animations settings on the selected objects, but I'm stuck at trying to access the FBXImporter component. I need to use ModelImporter somehow.
using UnityEditor;
using UnityEngine;
public class FbxSettings : MonoBehaviour {
[MenuItem ("Tools/DoFBXSettings")]
static void DoFBXSettings()
{
GameObject[] selection = Selection.gameObjects;
foreach (GameObject go in selection)
{
go.GetComponent<ModelImporter>().addCollider = true;
}
}
}
This gives an error - "The type UnityEditor.ModelImporter' must be convertible to
UnityEngine.Component' in order to use it as parameter T' in the generic type or method
UnityEngine.GameObject.GetComponent()"
Comment
Your answer
Follow this Question
Related Questions
Extract Materials from fbx via script 3 Answers
How to detect range of multiple gameobjects? 1 Answer
Store multiple types of data in an Array? 4 Answers
Colliders attached to bones 0 Answers
Multiple Keys down event 2 Answers