Im trying to change a photo of an object that is child of UI. I sought tastecraftedmcd.com yet every one of them claims to carry out this:

ImageName.sprite = newImage

It doesn"t occupational for me, tastecraftedmcd.com ignors this line and shows no error about it, the picture continues to be with "none" sprite. just how deserve to I resolve this?

here is some of my code:

private Image GetFace(Sprite player_f) Image challenge = PlayerBarExample.GetComponentInChildren(); challenge.sprite = player_f; ...

*

I uncovered my difficulty. I offered GetComponentInChildren(); and also forgut that there are various other imperiods which are son of this objectץ below what I did:

Image<> imeras = PlayerBarExample.GetComponentsInChildren(); Image confront = images<0>; foreach (Image photo in images) if (photo.gameObject.CompareTag("face")) face = image; and currently its functions, thx for the assist.

You are watching: Unity change source image


*

Hi, Try this code, i"ve checked it and it has actually no problem.

making use of System.Collections;using System.Collections.Generic;utilizing tastecraftedmcd.comEngine;utilizing tastecraftedmcd.comEngine.UI;

public course changephoto : MonoBehaviour

public Sprite newImage; exclusive Image myIMGcomponent; // Use this for initialization void Start () myIMGcomponent = this.GetComponent (); myIMGcomponent.sprite = newImage; // Update is dubbed once per framework void Upday ()


*

Attachments:Up to 2 attachments (including images) have the right to be supplied with a maximum of 524.3 kB each and 1.0 MB full.


Welcome to tastecraftedmcd.com tastecraftedmcd.com

The best location to ask and answer questions around breakthrough through tastecraftedmcd.com.

To aid individuals navigate the website we have posted a website navigating overview.

If you are a brand-new user to tastecraftedmcd.com tastecraftedmcd.com, check out our FAQ for more information.

Make certain to examine out our Knowledge Base for commonly asked tastecraftedmcd.com concerns.

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

See more: Fost And Found App - Fost And Found : Apps & Games

We are making enhancements to UA, see the list of alters.

*

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

How perform you include a picture to the Source Image Library 1Answer

just how execute i put an image from the internet in tastecraftedmcd.com? 2tastecraftedmcd.com

Fade GUITexture 1Answer

Blurry sprite in tastecraftedmcd.com 1Answer

How to Access the Source Image on "Image" new GUI? 1Answer


*
EnterpriseSocial Q&A


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

Acquisition Education Download tastecraftedmcd.com Labs Resources About tastecraftedmcd.com
"tastecraftedmcd.com", tastecraftedmcd.com logos, and also other tastecraftedmcd.com trademarks are trademarks or registered trademarks of tastecraftedmcd.com Technologies or its affiliates in the UNITED STATE and also somewhere else (even more information here). Other names or brands are trademarks of their corresponding owners.