Hi!
I've just bumped into a problem that I can't seem to figure out...
I have a sprite with several attach points. Some of them have stuff attached to them by design and other get attached stuffs on the fly. That's where my problem lies. When I instantiate a prefab and attach it to an attach point, then if I flip the parent sprite, I get the following error :
transform.position assign attempt for 'Player_goodtwin(Clone)' is not valid. Input position is { NaN, NaN, NaN }.Player_goodtwin (which by the way is a prefab instance) is the parent object and its basic structure is the following :
Player_goodtwin->PlayerSprite(tk2dSprite)->JetpackLight(the attach point).
Here's the code when I attach the prefab instance to the attach point, quite straightforward :
Transform anchorPoint = transform.FindChild("PlayerSprite/JetpackLight");
Transform clone = (Transform) Instantiate(burstPrefab, anchorPoint.position+Vector3.back*0.02f, Quaternion.identity);
clone.parent = anchorPoint;
The prefab gets attached to the attach point, no problem. Besides, if I don't flip the parent sprite, no problem neither. The problem occurs only if I XFlip the sprite when the prefab instance is attached to it. It also occurs if I pause the game when the Burst prefab is instantiated and I flip manually the sprite through the Inspector.
When I flip my sprite with only game objects attached to attach points by design, I don't have any problem.
Any idea would be really appreciated
Thank's!