Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Slater on August 19, 2014, 11:33:00 PM

Title: Prefabs messing up my project!
Post by: Slater on August 19, 2014, 11:33:00 PM
So I finally took the step and created a prefab for my menu system. In all my scenes I have a menu, where you can press a button on the side and a menu slides into view. There is also another button in that menu that pulls down another panel from the top, where you can choose to jump between chapters/scenes. I had to update some stuff now in it and up until now I have had only made a copy of it and pasted it into all the scenes. It was a hassle doing manually updates for all the scenes so I figured I would try out prefabs so I made the whole menu into one with all subparts.

The first problem was that in the cover scene and another scene, I needed it to be a bit different. So I did changes to it that I didn't apply. But for some changes still was put through to everything.

Then I noticed that when I had made the menu that a FSM I had for changing font size (font+ and font-) had target objects outside of the prefab that it applied the font size changes to. The game objects with the gui text objects on them. When I created the prefab it lost the linking to those object. I then clicked on change prefab in the FSM for the fonts, but it didn't let me add the gui text game objects outside of the prefab. So then I was forced to drag them into the menu and in order for it to stick to the prefab I dragged the menu to the prefab in my project folder. Then all seamed to be working and I did some other sizing changes to some images within the menu and applied it.

I then built for iOS and saved and closed down Unity, was going to bed. I then tried the app and noticed that everything had changed and there was no longer any subtitles at all in the app. So I checked Unity and now the text objects are totally missing from the project all together. Poof, disappeared with all their settings.

What the hell. What is going on?
Title: Re: Prefabs messing up my project!
Post by: Slater on August 20, 2014, 12:20:10 AM
Also even though I had them within the prefab I couldn't just add the font objects to the FSM target object. I had to do something in order for the menu to break away from being a prefab and then I could add them and then I updated the prefab with the new things.
Title: Re: Prefabs messing up my project!
Post by: Slater on August 21, 2014, 11:01:07 AM
What is wrong? Why isn't it possible to add a game object to an object variable when it is a prefab?
Title: Re: Prefabs messing up my project!
Post by: Lane on August 21, 2014, 11:31:36 AM
Hmm, not super sure what is happening but with the way Unity does prefabs it can be frustrating sometimes, yeah... Here's some general stuff I've come across over time...


There's a big official thread about Prefabs, what they are, what they should be, etc.. over on the Unity forums, maybe reading up on that will give you some ideas about how prefabs can work in practical application since a lot of devs have game published and have posted feedback on the Prefab setup in Unity.

Hopefully that helps a bit, I couldn't really tell what exactly might be wrong but it sounds like prefabs being mishandled.

Prefabs documentation (http://docs.unity3d.com/Manual/Prefabs.html)
Unity Prefab Feedback Thread (http://forum.unity3d.com/threads/official-prefab-improvements.253427/)