Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

I want to use transform command on my own library

$
0
0
Hi guys ! I want to make my own library but when I use the transform.position command for velocity I get an error. unity freezes already time. my DLL codes: namespace TestLDLL { public class Move { public GameObject moveObject; public Vector3 moveVector; public float speed; private bool canMove = false; public Move(GameObject moveObject, Vector3 moveVector, float speed) { this.moveObject = moveObject; this.moveVector = moveVector; this.speed = speed; } public void StartMove() { canMove = true; while(canMove) MoveFunc(); } public void StopMove() { canMove = false; } private void MoveFunc() { moveObject.transform.position += moveVector * speed * Time.deltaTime; } } } C# Scrip Code: public class test : MonoBehaviour { private Move moveObject; private Rigidbody rbody; void Start () { moveObject = new Move(this.gameObject, new Vector3(0f, 1f, 0f), 1f); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { moveObject.StartMove(); } if (Input.GetKeyDown(KeyCode.LeftShift)) { moveObject.StopMove(); } } }

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>