• 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 /
avatar image
2
Question by Magok_Stelios · Nov 29, 2014 at 10:56 PM · imageui image

How to crop UI Image

Greetings! I need to crop a UI image (that i use as healthbar) but apparently either I'm not good at searching things or can't find the answer... I don't want to change the scale because its complicated image and it will look messy, I want to crop or show the image based of the remaining life.

Any information is welcome I will do my best in that one!

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 Magok_Stelios · Nov 30, 2014 at 03:02 PM 0
Share

so, any help here? i'm still in dead end

3 Replies

· Add your reply
  • Sort: 
avatar image
11
Best Answer

Answer by Adcano · Nov 30, 2014 at 04:09 PM

You must set the image type to "Filled" in inspector.

If it's a health bar, your settings will be:

ImageType - Filled

Fill Method - horizontal

Fill Origin - left

Fill Amount - 1 (values go from 1 to 0) << Use that with scripting to reduce the healt ;)

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 Magok_Stelios · Nov 30, 2014 at 04:17 PM 0
Share

damn... so easy and couldn't make, i feel ashamed... thanks a lot dude :D

avatar image ElectricMonk · Sep 12, 2017 at 10:40 PM 0
Share

I was looking for this in unity 2017 and it seems to be hidden until you add a Source Image. Hopefully this is helpful to someone else.

avatar image Fattie · Jun 30, 2020 at 04:32 PM 0
Share

It's a great tip!

avatar image
0

Answer by Mjbgtaad56 · Jun 28, 2016 at 04:51 AM

You can use a "Mask" component which will make all child objects that are in the same aria as it visible.

If you create a UI Image then add a mask script then create a new UI Component as a child of the GameObject with a mask, the child will only appear where the parent GameObject is visible. There is also a checkbox on the Mask component to hide the mask image.

Comment
Add comment · Show 1 · 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 Keyserjaya99 · Dec 09, 2018 at 06:43 AM 0
Share

U saved my life, thank you so much!

avatar image
0

Answer by laurentlavigne · Aug 03, 2020 at 04:38 AM

https://forum.unity.com/threads/how-do-you-clip-an-image-with-another.944266/#post-6161944

Comment
Add comment · 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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

30 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

Related Questions

Check if UI element is fully inside another UI element 1 Answer

How to get solve two or more UI images alphas? 0 Answers

Images getting distorted -SOLVED 2 Answers

Adding Copy and Paste image function in-game 1 Answer

UI Image material did not get instanced. Why? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges