PersistentTrails.CraftLoader.findPartModel C# (CSharp) Method

findPartModel() public static method

public static findPartModel ( string partName ) : GameObject
partName string
return UnityEngine.GameObject
        public static GameObject findPartModel(string partName)
        {
            UrlDir.UrlConfig[] cfg = GameDatabase.Instance.GetConfigs("PART");
            //Debug.Log("looping through " + cfg.Length);
            for (int i = 0; i < cfg.Length; i++)
            {
                string modfiedPartName = partName.Replace('.', '_');
                if (modfiedPartName == cfg[i].name)
                {
                    //Debug.Log("found this part: " + cfg[i].url);
                    //float scale = 0.1337f;
                    //float.TryParse(cfg[i].config.GetValue("scale"), out scale);
                    //Debug.Log("scale: " + scale);
                    string modelPath = cfg[i].parent.parent.url + "/" + "model";
                    //Debug.Log("model path: " + modelPath);
                    GameObject newModel = GameDatabase.Instance.GetModel(modelPath);
                    if (newModel == null)
                    {
                        //Debug.Log("model load error, fetching first model available");
                        newModel = GameDatabase.Instance.GetModelIn(cfg[i].parent.parent.url);
                        return newModel;
                        //return new PartValue(newModel, scale);
                    }
                    else
                    {
                        //Debug.Log("newModel not null");
                        return newModel;
                    }
                }
            }
            Utilities.debug.debugMessage("Finding model " + partName + " failed, returning blank GameObject");
            return new GameObject();
        }