Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Artifact

Pages: [1]
1
Why will the following code give me a null ref exception:

Code: [Select]
    private tk2dSpriteCollection sCollection;

// Use this for initialization
void Start ()
{
        sCollection.spriteCollection = GetComponent<tk2dSprite>().Collection;   
}

And the following code doesn't give me an exception, I'm not assigning anything to the public object, the only thing I'm doing is changing the access modifiers from private to public...

Code: [Select]
    public tk2dSpriteCollection sCollection;

// Use this for initialization
void Start ()
{
        sCollection.spriteCollection = GetComponent<tk2dSprite>().Collection;
}

2
Support / Can't open SpriteCollection editor
« on: June 13, 2013, 09:44:54 am »
When I select a sprite collection prefab and click the "Open Editor" button nothing happens. The editor simply won't open.
I tried to create a new Unity project and reimport everything but that didn't solve the problem.

Note: I have no problems opening the SpriteAnimation editor & I'm using version 2.0.

How do I solve this problem?

3
Support / Collider size is set to 0 when image is changed on sprite
« on: February 17, 2012, 12:36:22 am »
Hello, I have a sprite and I ticked the create collider. It creates a box collider on my sprite.
I set this collider to the size I want it, but whenever I run my game and the sprite is animating, it sets the size of my sprite to 0,0,0.

Can anyone help me solve this issue.

Thx in advance :)

4
Support / Animating multiple sprites with the same script
« on: February 16, 2012, 06:52:05 pm »
Hello, I need some help animating 2 sprites with the same script. Right now I have 2 enemy sprites I wan't to animate with the same script. The method that moves and animates them looks like this:

Code: [Select]
    void MoveToPlayer()
    {
        if (enemyTransform.localPosition.x >= player.transform.localPosition.x)
        {
            enemySpeed = 5;
            enemyTransform.Translate(Vector3.left * amountToMove, Space.World);
            anim.Play("WalkLeft");

        }
        else if (enemyTransform.localPosition.x <= player.transform.localPosition.x)
        {
            enemySpeed = 5;
            enemyTransform.Translate(Vector3.right * amountToMove, Space.World);
            anim.Play("WalkRight");
           
        }
    }

The problem is that if I add this script to both my sprites it only animates one of them, the other just moves without any animation. Some help with this issue would really be appreciated.

Thanks in advance :)


Pages: [1]