2D Toolkit Forum

2D Toolkit => Support => Topic started by: JFBillingsley on September 19, 2013, 08:24:59 am

Title: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: JFBillingsley on September 19, 2013, 08:24:59 am
Repro steps:

1) Make a blank GameObject
2) Put a tk2dUIItem script on it
3) Drag that same GameObject into the "Send Message Target" slot on the tk2dUIItem
4) Drag the GameObject into the project pane to make it a prefab

The "Send Message target" slot in the prefab (and in any instances of it) is now null, and can never be changed. I swear it didn't use to do this with previous versions of TK2D...
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: gary-unikronsoftware on September 19, 2013, 08:52:24 am
Hi,

Yes this was a bug in a previous version of toolkit (http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,2356.msg11790.html#msg11790), good news is that I have just tested it in toolkit 2.2 final and it's been fixed now.
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: JFBillingsley on September 19, 2013, 08:53:54 am
Great! Sadly I can't update to 2.2 on this project, buuut if it's a one-liner fix or something, can you let me know how to do it?
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: gary-unikronsoftware on September 19, 2013, 09:35:26 am
Yeah, the last post in the link to the other thread tells you what you need to do, its a pretty simple change but let us know if you have any problems.
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: JFBillingsley on September 19, 2013, 09:38:26 am
Cool, thanks.
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: user1900 on March 04, 2014, 09:41:16 am
Is there a fix available for this bug? The link doen't work for me.

Or does someone else has a solution for this problem. Otherwise I can also attach a script which detact a mouse down event?

Btw: I am using Version 2.3.3 and the Bug is still present. Thanks in advance!
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: unikronsoftware on March 04, 2014, 10:59:40 am
That was fixed in 2.2, and just tested that it works fine in 2.3 too. What are you trying to do here? Can you give me exact steps?
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: user1900 on March 04, 2014, 12:39:50 pm
Sure.

I have a prefab which contains a button (tk2dUIItem). In the Send Message Target I attached a GameObject which contains a Script. In this Script I have a function and this function is assigned to the Send Message Target. It is saved until I run my Application or editing the prefab or just swich between scenes. Is it possible to save the GameObject (only exist in the Scene) with a prefab? I guess my error occurs because I assigned a GameObject which only exist in the Scene so the prefab is not able to save when switching scenes?
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: unikronsoftware on March 04, 2014, 12:47:35 pm
You can't have a link to a scene object from a prefab. You can apply it but it won't be remembered.
Title: Re: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)
Post by: user1900 on March 04, 2014, 12:59:43 pm
Ok. I thought as much! Thank you for your response!