コード例 #1
0
    private void SplitIntoTwo(string spriteName)
    {
        Debug.Log(spriteName);
        Sprite[] temp = null;
        temp = CharacterSpawner.GetSprSides(spriteName);
        if (temp != null)
        {
            Debug.Log(temp[0].name);
            Debug.Log(temp[1].name);
        }
        else
        {
            Debug.Log("Didnot get sprite splits");
        }
        GameObject partOne = GameObjectUtility.customInstantiate(prefabPartOne, transform.position + new Vector3(0.8f, 0f, 0f));

        partOne.GetComponent <SpriteRenderer> ().sprite = temp [0];
        GameObject partTwo = GameObjectUtility.customInstantiate(prefabPartTwo, transform.position + new Vector3(-0.8f, 0f, 0f));

        partTwo.GetComponent <SpriteRenderer> ().sprite = temp [1];
    }