Hello Guest

Author Topic: 2D Toolkit 2.0 beta 1  (Read 81014 times)

reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #45 on: May 31, 2013, 04:03:45 pm »
Also, a quick question :

Is it possible to attach a UICamera to the UIManager at runtime ? UICamera is Read Only, is there a reason for this?


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #46 on: May 31, 2013, 04:53:13 pm »
4.1.3f3

Thanks!


Nothing to worry about. Unity seems to be doing a string compare to find functions starting with OnMouse, the one we use is an internal event which shouldn't cause any issues at all. I'll rename it in the next release - no more warnings after renaming it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #47 on: May 31, 2013, 04:54:36 pm »
Also, a quick question :

Is it possible to attach a UICamera to the UIManager at runtime ? UICamera is Read Only, is there a reason for this?

No specific reason, but there didn't seem to be any compelling reason to create/modify it at runtime either. Any specific reason you might want to do that, seeing that the rest of the system is built to be set up visually anyway?

reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #48 on: May 31, 2013, 06:15:30 pm »
4.1.3f3

Thanks!


Nothing to worry about. Unity seems to be doing a string compare to find functions starting with OnMouse, the one we use is an internal event which shouldn't cause any issues at all. I'll rename it in the next release - no more warnings after renaming it.

Awesome, thanks!

reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #49 on: May 31, 2013, 06:19:05 pm »
Also, a quick question :

Is it possible to attach a UICamera to the UIManager at runtime ? UICamera is Read Only, is there a reason for this?

No specific reason, but there didn't seem to be any compelling reason to create/modify it at runtime either. Any specific reason you might want to do that, seeing that the rest of the system is built to be set up visually anyway?

Nothing I can't work around, I'm creating my Cameras at run time, so wanted to be able to attach one to the UIManager after creation.

Fantastic framework, and an awesome update by the way!


reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #50 on: May 31, 2013, 07:07:30 pm »
Also, a quick question :

Is it possible to attach a UICamera to the UIManager at runtime ? UICamera is Read Only, is there a reason for this?

No specific reason, but there didn't seem to be any compelling reason to create/modify it at runtime either. Any specific reason you might want to do that, seeing that the rest of the system is built to be set up visually anyway?

Actually, no second thoughts, I think it would be useful to be able to attach the camera at runtime.

My Cameras are instantiated from prefabs. My UIManager is also instantiated from a prefab.

So unless I'm missing something obvious, I'm not able to attach my chosen camera instantiation time without UICamera being public.

What do you think?
 

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #51 on: May 31, 2013, 07:11:49 pm »
Does it work OK for you if you made it public? I can and I will, but since I don't have a test case for this its probably worth checking your findings first.

reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #52 on: May 31, 2013, 07:53:33 pm »
Does it work OK for you if you made it public? I can and I will, but since I don't have a test case for this its probably worth checking your findings first.

Yes, works perfectly for me if I add a public setter to tk2dUIManager.

The only issue I see is finding a safe way to suppress the :

Code: [Select]
if (uiCamera == null)
        {
            Debug.LogWarning("Camera needs to be attached to tk2dUIManager for it to work");
        }

Can the setUp code move to Start() from Awake() ?

I may also want to change the camera at a future point in time too, looking at the code it doesn't look problematic to me, but let me know what you think.

Perhaps we could have a specialised subclass that is prefab / instantiate  at runtime friendly.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #53 on: May 31, 2013, 10:41:25 pm »
It should be fine to change the camera. It simply uses it to raycast, so there isn't really any issue with that.

I'm not sure if anything should be one about that message - perhaps you could addcomponent on a disabled game object, so awake doesn't get called immediately, and then enable it? The message is rather critical to the enduser, though it obviously isn't in your case....

reefG

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #54 on: May 31, 2013, 11:17:30 pm »
It should be fine to change the camera. It simply uses it to raycast, so there isn't really any issue with that.

I'm not sure if anything should be one about that message - perhaps you could addcomponent on a disabled game object, so awake doesn't get called immediately, and then enable it? The message is rather critical to the enduser, though it obviously isn't in your case....

Great, thanks for looking into this.

I'm sure I can live with the warning, it's fully explainable, and I guess I'm probably a bit of an edge case!

I think adding a setter for UICamera will be more than fine for what I need.

Loving the new features in 2.0.0, thanks!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.0 beta 1
« Reply #55 on: May 31, 2013, 11:47:49 pm »
Glad you like the new features in 2.0.
We're just getting started, a lot more tasty features coming soon :)