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.


Messages - Benjam901

Pages: [1]
1
Support / Re: Unity 4.3 & 2D Toolkit issues
« on: November 18, 2013, 09:09:12 pm »
Just to be a little more concise here is the exact error :)

tk2d Undo/Redo callback failed. Undo/Redo not supported in this version of Unity.
UnityEngine.Debug:LogError(Object)
tk2dEditorUtility:.cctor() (at Assets/TK2DROOT/tk2d/Editor/tk2dEditorUtility.cs:18)
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

2
Support / Unity 4.3 & 2D Toolkit issues
« on: November 18, 2013, 08:21:47 pm »
Hello,

I am having a few issues with Unity 4.3 and 2D Toolkit, mainly the undo/redo operation is not working in one of your program scripts?

I was wondering if perhaps there is a patch being worked on for it at the moment or that I might have an older version of 2D toolkit and this might be the issue, how do I check which version I have?

Cheers!

3
Support / Re: Assign a game object dynamically
« on: November 11, 2013, 07:22:52 pm »
Aha! All sorted now :)

I had the setID line before I had set the new library which was why it was not doing it properly. Cheers ofr the help!

4
Support / Re: Assign a game object dynamically
« on: November 09, 2013, 09:15:36 pm »
My clip ID is returning as -1? what does this mean and how should I look into fixing it it is a problem?

Here is the full error:

IndexOutOfRangeException: Array index is out of range.
tk2dSprite.UpdateMaterial () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs:202)
tk2dBaseSprite.SetSprite (.tk2dSpriteCollectionData newCollection, Int32 newSpriteId) (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:231)
tk2dSpriteAnimator.SetSprite (.tk2dSpriteCollectionData spriteCollection, Int32 spriteId) (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs:729)
Getting_Up.changeLibrary (System.String nameOfLib, System.String nameOfCol) (at Assets/Scripts/Character_Interaction/Getting_Up.cs:108)
Getting_Up.returnToIdle (.tk2dSpriteAnimator sprite, .tk2dSpriteAnimationClip clip) (at Assets/Scripts/Character_Interaction/Getting_Up.cs:46)
tk2dSpriteAnimator.OnAnimationCompleted () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs:719)

5
Support / Re: Assign a game object dynamically
« on: November 09, 2013, 08:19:54 pm »
I have managed to change the collection but it is now throwing me this error:
IndexOutOfRangeException: Array index is out of range.

Something about materials? Could this be because my sprite collection is on multiple atlases?

6
Support / Re: Assign a game object dynamically
« on: November 09, 2013, 07:43:24 pm »
Character is the name of the sprite game object in unity.

What I am doing is using one script to handle the getting out of bed stuff and switching between animations and when he gets out of bed the script is destroyed and the walking script is attached. I need to assign the animated sprite an object reference because I am gettign this error:

NullReferenceException: Object reference not set to an instance of an object

7
Support / Re: Assign a game object dynamically
« on: November 09, 2013, 04:45:04 pm »
What I am trying to do is to assign the actual sprite to the game animator for it to reference its height and position etc.

See image with arrow pointing to what I need to assign



I also need to change the sprite collection which I am working on at the moment. I just need these 2 things then I can carry on with the project :)

The code for the start function (Which doesn't seem to be doing much at the moment) Is as follows:

Code: [Select]
void start()
{
//characterGameObj = new GameObject.Find("Character");
print(characterGameObj);
//sprite_Character.Library = Resources.Load("MovementLib", typeof(tk2dSpriteAnimation)) as tk2dSpriteAnimation; //sets a library(For some reason it doesnt work, but it works with other libraries)???
spriteID = sprite_Character.GetClipIdByName("Library_Walking");

spriteCollection = Resources.Load ("Collection_WalkCycle", typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData; //this must be of type Data to work properly when passing it into sprite_Character
sprite_Character = GetComponent<tk2dSpriteAnimator>();
sprite_Character = tk2dSpriteAnimator.AddComponent(GameObject.Find("Character"), sprite_Character.Library, sprite_Character.GetClipIdByName("Anim_WalkingClip"));
}

Any thoughts?

8
Support / Re: Assign a game object dynamically
« on: November 07, 2013, 11:44:17 am »
No, what I am doing is removing one script from the character and assigning another. But as I am assigning another I need to tell unity to use the character as the game object and the transform.

Usually I would use character = gameobject.find("character"); or just assign the character game object in the inspector to do this, but 2D toolkit needs to use addcomponent if you are doing this in script.

9
Support / Assign a game object dynamically
« on: November 06, 2013, 11:02:24 pm »
Hello,

I have been trying to figure out how to assign my character to the game object at runtime. I am adding a new script and need to assign the game objects in the start function but I cannot seem to get it to work.

This is what I have so far:
Code: [Select]
void start()
{
spriteID = sprite_Character.GetClipIdByName("Library_Walking");
spriteCollection = Resources.Load ("Collection_WalkCycle", typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
sprite_Character = GetComponent<tk2dSpriteAnimator>();
sprite_Character = tk2dSpriteAnimator.AddComponent(GameObject.Find("Character"), spriteCollection, spriteID);
}

The errors I am getting as as follows:

Assets/Scripts/Character_Interaction/Base_Interaction.cs(45,55): error CS1503: Argument `#2' cannot convert `tk2dSpriteCollectionData' expression to type `tk2dSpriteAnimation'

Also I am not sure if I fully understand/am using int spriteID correctly. Can someone explain how this works please and if I should use a collection or a library for this :)

Thanks!

:)

10
Support / Re: Need help changing sprite libraries
« on: November 06, 2013, 10:19:23 pm »
YEs I got it working thank you :)

It seemed it did not like it being in a sub folder

11
Support / Re: Need help changing sprite libraries
« on: November 04, 2013, 08:51:04 pm »
I have also put the libraries and such in a folder called Resources but when I try to load it it returns as a null value

12
Support / Need help changing sprite libraries
« on: November 04, 2013, 08:32:36 pm »
Hello 2D Toolkit users,

I have a query for you. I am changing my animated sprites library at run time but instead of changing to the library like I want it to it is setting the library to DemoAnimations instead?

I am not sure what I am doing wrong but perhaps I need to have my folders structured inside the TK2D root folders?

The code I am using for this is as follows:

Code: [Select]
void changeLibrary()
{
Destroy(this);
gameObject.AddComponent("Base_Interaction");
getUpSprite.Library = Resources.Load("MovementLib", typeof(tk2dSpriteAnimation)) as tk2dSpriteAnimation;;
}

Any help would be awesome!

Cheers guys :)

Benjam

Pages: [1]