Hello Guest

Author Topic: tk2dUIItem loses its Send Message Target permanently when put in a prefab (2.10)  (Read 7878 times)

JFBillingsley

  • Newbie
  • *
  • Posts: 18
    • View Profile
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...

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
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.

JFBillingsley

  • Newbie
  • *
  • Posts: 18
    • View Profile
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?

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
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.

JFBillingsley

  • Newbie
  • *
  • Posts: 18
    • View Profile
Cool, thanks.

user1900

  • Newbie
  • *
  • Posts: 5
    • View Profile
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!
« Last Edit: March 04, 2014, 09:51:21 am by user1900 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
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?

user1900

  • Newbie
  • *
  • Posts: 5
    • View Profile
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?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
You can't have a link to a scene object from a prefab. You can apply it but it won't be remembered.

user1900

  • Newbie
  • *
  • Posts: 5
    • View Profile
Ok. I thought as much! Thank you for your response!