Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- public class ModelPropertyProcessor : AssetPostprocessor {
- void OnPostprocessGameObjectWithUserProperties (GameObject go, string[] propNames, System.Object[] values) {
- for (int i = 0; i < propNames.Length; i++) {
- string propName = propNames[i];
- System.Object v = values[i];
- Debug.Log("Model "+go.name+" has Property: " + propName + " with value: " +v);
- if (propName == "UDP3DSMAX")
- {
- // max exports all props as single string. we must split by return char
- string[] lines = ((string)v).Split('\n');
- foreach (string line in lines)
- {
- string prop = line.Trim();
- Debug.Log (prop);
- if (prop == "boxcollider")
- {
- go.AddComponent<BoxCollider>();
- }
- if (prop == "spherecollider")
- {
- go.AddComponent<SphereCollider>();
- }
- if (prop == "meshcollider")
- {
- go.AddComponent<MeshCollider>();
- }
- if (prop == "proxy")
- {
- go.renderer.enabled = false;
- }
- if (prop == "movable")
- {
- go.AddComponent<Rigidbody>();
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement