Setting position of GameObject

Hello :smile:,
I have a simple question, how to set position of GameObject which contain following components?

image
http://imgur.com/LHxKIHO

I know, it's pretty beginner question, but I tried 3 different commands and it still don't work..
Please help, I'll be glad for any kind of help :smile:

Best Answer

  • keeps
    keeps
    Accepted Answer
    If you're trying to set the initial TSTransform state from Unitys transform, then you could do something like this on Awake, this probably isn't an ideal solution, but it's been working for me so far.
       void Awake() {
          TSTransform2D tsTransform = GetComponent<TSTransform2D>();
          // position is TSVector2, scale is TSVector
          tsTransform.position = transform.position.ToTSVector2();
          tsTransform.scale = transform.localScale.ToTSVector();
          tsTransform.rotation = (FP)transform.rotation.eulerAngles.z;
       }

Answers

  • keeps
    keeps
    Accepted Answer
    If you're trying to set the initial TSTransform state from Unitys transform, then you could do something like this on Awake, this probably isn't an ideal solution, but it's been working for me so far.
       void Awake() {
          TSTransform2D tsTransform = GetComponent<TSTransform2D>();
          // position is TSVector2, scale is TSVector
          tsTransform.position = transform.position.ToTSVector2();
          tsTransform.scale = transform.localScale.ToTSVector();
          tsTransform.rotation = (FP)transform.rotation.eulerAngles.z;
       }
  • If you're trying to set the initial TSTransform state from Unitys transform, then you could do something like this on Awake, this probably isn't an ideal solution, but it's been working for me so far.
       void Awake() {
          TSTransform2D tsTransform = GetComponent<TSTransform2D>();
          // position is TSVector2, scale is TSVector
          tsTransform.position = transform.position.ToTSVector2();
          tsTransform.scale = transform.localScale.ToTSVector();
          tsTransform.rotation = (FP)transform.rotation.eulerAngles.z;
       }
  • If you're trying to set the initial TSTransform state from Unitys transform, then you could do something like this on Awake, this probably isn't an ideal solution, but it's been working for me so far.
       void Awake() {
          TSTransform2D tsTransform = GetComponent<TSTransform2D>();
          // position is TSVector2, scale is TSVector
          tsTransform.position = transform.position.ToTSVector2();
          tsTransform.scale = transform.localScale.ToTSVector();
          tsTransform.rotation = (FP)transform.rotation.eulerAngles.z;
       }
  • I can't see a way to delete my accidental reposts, sorry -_-
  • Thx @keeps, it't working! Btw, sorry for late reply, I didn't had any time.. :)