I have the following script which I can attach to an object to get it to wrap around the screen. I would like to know how I would do this using Playmaker instead of a script.
I know it will involve using "Every Frame", however everything I have tried results in some kind of loop that Playmaker detects and stops after 1000 iterations.
using UnityEngine;
using System.Collections;
public class WrapScreen : MonoBehaviour {
public float xPos, xNeg, yPos, yNeg;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (transform.position.x > xPos)
{
transform.position = new Vector3(xNeg, transform.position.y, transform.position.z);
}
if (transform.position.x < xNeg)
{
transform.position = new Vector3(xPos, transform.position.y, transform.position.z);
}
if (transform.position.y > yPos)
{
transform.position = new Vector3(transform.position.x, yNeg, transform.position.z);
}
if (transform.position.y < yNeg)
{
transform.position = new Vector3(transform.position.x, yPos, transform.position.z);
}
}
}