Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Mar 17, 2014 at 10:38 PM by serenefox for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by serenefox · Mar 17, 2014 at 03:37 AM · guiprefabnull

Cannot apply certain elements in prefabs(GUI)?

Hello,

I have a character prefab and am trying to update it in the prefabs folder I have in my project window by pressing apply and/or dragging the character to replace the character prefab in the project view. Everything “applies” when I do that except for the GUI elements that were assigned.

For example, I have “hearts” gui as sprites for life in the top right of my screen and in the inspector I have slots for the hearts to be assigned. But when I do assign it then apply it and redrag out the prefab into the scene all the GUI elements are reset to null in the slots on the prefab. Is there a reason it’s doing this? Can I not do this?

Is it because I can't reference GUI elements in a prefab(even though the GUI is the same in each scene)? This is just a guess but I was wondering if it's right. If it is right can I just initiate it in the start function or will it be the same? I am using Daikon Forge GUI but I don't think that is the problem.

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by kannan21 · Mar 17, 2014 at 06:50 AM

Assigning it in start will solve the problem for sure. But you can assign GUI elements to a prefab. There should not be any problem in that.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image serenefox · Mar 17, 2014 at 06:44 PM 0
Share

Thank you for the reply, I just talked to someone about it and they said you can't assign GUI elements to a prefab but as you said assigning them in start will work. So I will mark this as the answer since it would have fixed it anyway. Thanks again!

avatar image Bunny83 · Mar 17, 2014 at 07:05 PM 0
Share

The problem is that you can't reference anything from a scene inside a prefab. Objects in scenes aren't there all the time, only when the level is loaded. Prefabs on the other hand are assets which can be used everywhere. So it's impossible for a prefab to reference an instance inside a scene.

Also you said all scenes have the same objects. That would mean each scene has it's own set of objects. Just because every B$$anonymous$$W has s driverseat you can't reference one to get them all ;)

avatar image serenefox · Mar 17, 2014 at 10:38 PM 0
Share

Yeah I can't believe I've never encountered this before, I have been working with Unity on and off for 2 years now too. I also can't believe how noobish my question was :)

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Howt to Replace uGUI with asset bundles 0 Answers

Can't retrieve information from GameObject 2 Answers

Strange GUITexture prefab problem with pixelInset.width 1 Answer

Deleting a Prefab when it is dragged to a GUI Texture 0 Answers

Access components in children of a prefab? 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges