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 - gabriel

Pages: [1]
1
Support / Re: managing instanced materials
« on: September 18, 2015, 01:19:03 am »
Ok thank you.
Thanks also for the great asset!

2
Support / Re: managing instanced materials
« on: September 17, 2015, 09:00:21 pm »
I figured out most of these answers.
"atlas0 material" is the way to go, and there is no difference with animation or tilemap.
also, my problem was derived from the use of tk2dSpriteCollection instead of tk2dSpriteCollectionData. In using the latter, everything works both in the editor and on iOS. I still do not understand, however, the fact that caching a reference to a tk2dSpriteCollection was provoking a silent crash in a case and worked fine in the other...

Lastly, I would still be interested in knowing if looking up the coll.spriteCollection.FirstValidDefinition is the correct and safe way to go to catch the shared material. What should be done if no tk2dSpriteDefinition exist at that time? should the atlas0 be modified to ensure that generated sprites will have the correct parameter?

3
Support / managing instanced materials
« on: September 16, 2015, 04:15:35 am »
    I have a problem and a few questions on materials and sprite collections

    • What is the proper way to assign a custom shader to all sprites from a tk2dSpriteCollection? Is modifying "atlas0 material" in Data folders the correct solution?
    • If I want to modify a value on this material at runtime, what would be the way to go? (I do want to modify ALL the referenced sprites as efficiently as possible)
    • Is refering to sprite collections by a "public List<tk2dSpriteCollection>" correct?
    • Finally, is anything should be done differently about tilemaps and animations?

    This is the way i currently try to do it:

Code: [Select]
private void setBrightness(tk2dSpriteCollection coll, float brightness_value) { //on the source material
tk2dSpriteDefinition spriteDef = coll.spriteCollection.FirstValidDefinition;
if (spriteDef != null) {
Material sharedMat = spriteDef.materialInst;
sharedMat.SetFloat("_Brightness", brightness_value);
}
}

It works correctly in the editor but there is some unspecified crash when I try it on iOS. I'm suspecting a precise SpriteCollection of causing it simply by being referred to in a public variable (my setBrightness() is not called initially). Any thought of where to look?

The problematic sprite collection also have difficulty to get its own Atlas Width/Height from inside the Sprite collection UI. I wonder if there is some kind of corruption here.

4
Support / Re: ScreenToWorldPoint()
« on: May 07, 2015, 07:40:47 pm »
Nevermind. I found it. :)

myCamera.ScreenCamera.ScreenToWorldPoint()

5
Support / ScreenToWorldPoint()
« on: May 07, 2015, 05:16:29 pm »
I'm new using 2d Toolkit and I can't seem to find it. myMainCamera.ScreenToWorldPoint() is not valid ... And I must be blind...

I'm trying my make my camera draggable and the use of camera Overrides and ZoomFactor make it tedious to calculate modifications to Screen/World relations.

If ScreenToWorldPoint() is not a valid function on a tk2dCamera, what I'm I missing?

Pages: [1]