Monday, November 16, 2015

How to Change Girl Dress in unity

iklan



1import girl charater model to unity
2Create Canvas Button with canvaschange name to 'Click to Change Girl Dress'.
3Attach below code to CanvasShow to button OnClick(). show to 'Change_Dress()' function.
4Last Step  - You should show 'Girl Texture' and 'Girl Material(it is located at girls model)' to script.

Click the button and Change Girl Dress


Code :-


using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CharacterHiding : MonoBehaviour {
    public Texture NewDressTexture = new Texture ();
    public Renderer rend;

    void Start () {
        // Find girl shader material at charater childern
        Renderer rend = GetComponentInChildren<Renderer>();
    }


    public void Change_Dress() // Attach this function to Button (Dress change button)
    {
        rend.material.mainTexture = NewDressTexture;
    }
}


Screenshots :-






How to Change Girl Dress in unity
4/ 5
Oleh