Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 22, 2020 at 10:30 PM by M1Z4 for the following reason:

Other

avatar image
0
Question by M1Z4 · Mar 08, 2020 at 09:56 PM · uibuild-errorammoweapon systemexport problem

Unity UI not rendering ammo icon when build unity 2018.4.18

I have an ammo counter setup in my scene that shows the fill ratio for each weapon and cycles through the different UI icons when player changes weapons, and it works fine in the editor but when i built my project only the UI icon for the primary weapon is visible but when the player changes weapons the icon disappears.

Primary Weapon with visible UI icon on the bottom left corner: alt text

Secondary Weapon with missing UI on the bottom left corner:alt text

primaryweapon2.jpg (221.8 kB)
missingui.jpg (213.8 kB)
Comment
Add comment · Show 1
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 M1Z4 · Mar 08, 2020 at 09:58 PM 0
Share

the secondary weapon icon works fine in the editor:alt text

secondaryweaponeditor.jpg (229.5 kB)

1 Reply

  • Sort: 
avatar image
0

Answer by BBIT-SOLUTIONS · Mar 08, 2020 at 10:15 PM

When it works in editor, then it's maybe a problem with the screen resolution.

Think you can test, if the problem already appears when you change the screen dimensions in the game-view.

And then you should maybe check if both images (in the assets) have same dimensions (pixel-size, aspect-ratio, filetype) and same import settings.

Also maybe check if you are anchoring your images in the UI or if you have set any hard-coded pixel-values (for left, right, top or bottom). That could also maybe make the image disappear in worst-case for some screen-resolutions.

Do you also just exchange the sprite of the same image component or do you use extra GameObjects for each icon? In second case, also ensure, that RectTransform of all GameObjects has same settings.

Comment
Add comment · Show 5 · 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 M1Z4 · Mar 10, 2020 at 12:44 AM 0
Share

Thank you for your feedback. I tried messing around with screen resolution but it works absolutely fine in the game view, and the sprites have same import settings and same size, resolution etc. Tried changing the anchoring and transform and still works in game view but does not work when build. And i have a prefab called "ammocounter" that deals with switching the weapon icons based on which weapons are chosen. Each weapon prefab have their own set of icon images attached to them that get called by the ammocounter prefab. The ammocounter prefab also has an opacity slider that basically hides the weapon icon for the unselected weapon and shows the icon for selected weapon that basically takes care of switching the icons. Still don't understand why it would not show in the build but work fine in the editor.

avatar image BBIT-SOLUTIONS M1Z4 · Mar 10, 2020 at 02:20 AM 0
Share

Ok, i see. Happens the problem only with exactly this secondary weapon or with other weapons, too? And because you are using opacity for hiding them: Do you have ensured, that all variables which are responsible for that, are defined (e.g. in Awake() or Start()). If they are undefined, it could maybe happen, that it's randomly set to true (or 1) in editor and false (or -1 etc) in your build...

avatar image M1Z4 BBIT-SOLUTIONS · Mar 10, 2020 at 02:17 PM 0
Share

Here's the code i am using, not using any awake or start function but i have an initialize and the default unselectedOpacity has a value of .5 which is edited to be 0 in the prefab in the editor. And the problem happens only with the secondary weapons but not with the primary weapon.

Show more comments

Follow this Question

Answers Answers and Comments

207 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Display Ammo Count Above Player 1 Answer

FPS UI ammo display problem 0 Answers

Texture Glitch 0 Answers

Issues with UnityEngine.UI when referenced in a class library, since Unity 2019 1 Answer

Image dissappearing when assigning fill amount 0 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