- Home /
Question by
deadlycrow · Mar 26, 2014 at 06:49 PM ·
prefabmaterialcreatelost
Prefab loosing materials
hi, when i create a prefab from code all of it materials and stuff get lost, how can i solve that?(the GameObject is a Empty parent, with like 5 five childrens, and every one of them has inside like 2 or 3 particles) see it in action: https://www.youtube.com/watch?v=h7UR2Jk_OvA
this is my code:
var CharToPrefab: GameObject;
var CharNameObj: GameObject;
var CharName: String;
function Update(){
CharName = CharNameObj.GetComponent(TextName).namefield;
}
function OnMouseOver(){
if(Input.GetButtonDown("Fire1")){
PrefabUtility.CreatePrefab("Assets/PlayerPrefab/SPIRIT/"+CharName+".prefab",CharToPrefab);
}
}
when the mouse is over the "CREATE" button and press click, the prefab is placed in that folder, but when i put it back on the scene has no materials, texturs, nothing, the particles also lose the materials :(
Comment
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Prefab Material 0 Answers
Mesh and material disappear after CreatePrefab() in C# 1 Answer
No material and prefab connections 1 Answer