- Home /
What files are responsible for script components on prefabs?
When I do an SVN commit of my changes, then do a test checkout of my Unity project, some of my prefabs will be missing their script component.
Like, say I have a prefab called: SystemCanvas, which is parent to a button called: SystemButton, and that has a component called: "SystemButton".
The "SystemButton" will be missing.
I've noticed this problem on a lot of prefabs, and I don't know why this is happening.
I have the SystemCanvas.prefab, and SystemCanvas.prefab.meta comitted already, so I must be missing some other file.
Edit: I already committed SystemButton.cs.
Answer by ghostmode · Oct 12, 2017 at 10:13 PM
Another idea: Be prepared to do a hard revert on your svn, or use a copy of your project and a new svn repo to try this. Set 'Asset Serialization Mode' to 'Force Text' (Edit/Project Settings/Editor)
Thanks! If you post this as an answer, I'll mark it as the solution.
Answer by ghostmode · Oct 11, 2017 at 08:56 PM
You also need to check in the "SystemButton.cs" file, this is the component you created and attached to your button.
Edit: And also "SystemButton.cs.meta" as @Bunny83 mentions below.
I already did that. It can be re-added on the client side, it's just not obvious for someone else working on the project which script is supposed to be there, and this happens for a lot of prefabs.
$$anonymous$$aybe you forget the meta file of the script? Every asset in your project should have a corresponding meta file.
You can't quite 're-add' script files and have your references work, as Unity doesn't use the file name to refer to components, but rather a guid that is assigned when a new file is created/imported. This is stored in the the corresponding meta file mentioned by Bunny.
systemButton.cs can be added as a component to SystemButton on a checked out copy of the project and it will work. It's just too much of a hassle to have to tell anyone who works with me which prefabs they have to fix after checking out the project, and again when I'm updating and getting their work.
There are guides about using version control with unity that mention things you might or might not have already done.
Thanks Nose, I learned something useful from that, but unfortunately, it didn't pertain to this problem.
Your answer
Follow this Question
Related Questions
Animated character FBX workflow question 1 Answer
How to add components to all spawned prefabs ? 0 Answers
can you access a script in a prefab and change its value 1 Answer
can I update prefab Assets with new 3D files without resetting their components? 2 Answers
Why are Prefabs now storing a list of modifications? 1 Answer