Hi, I’m rather new to Unity and am having some trouble getting started. Keep in mind this will be an Android app coded with C#.
I’m trying to position a gameObject sprite to the lower left of the screen regardless of aspect ratio.
I’ve tried this but it doesn’t seem to do anything when I run it in Unity.
using UnityEngine;
using System.Collections;
public class TargetObject : MonoBehaviour {
public GameObject targetObject;
public Vector3 startPosition = new Vector3(5,5,0);
// Use this for initialization
void Start () {
// Set the mask to the lower left corner of screen
if (targetObject != null)
{
targetObject.transform.position = Camera.main.ScreenToWorldPoint(startPosition);
}
}
// Update is called once per frame
void Update () {
}
}
Any help would be appreciated. Thanks