Hello,
So i am trying to make a top down game, and I have the joystick working, however I did create a simple script to move the “Main Camera”, but its still showing the main canvas when I test, never moving with the player/object when the joystick is moved… and the character/player does move find… its just the camera or the view never moves with it… which… I think is the canvas… but not certain… I took a screen shot of how my setup is… but here it is in text:
Scene
Main Camera
Main - Canvas
Spawn point 1 - Empty Object will be used for later
Spawn point 2 - Empty Object will be used for later
Spawn point 3 - Empty Object will be used for later
Spawn point 4 - Empty Object will be used for later
Spawn point 5 - Empty Object will be used for later
HouseCanvas
Panel
Background - Image
PlayerCanvas
PlayerChar - This is the object I want the camera to follow
UI_Panel - this has the joystick and buttons
Message_txt - to be used later on…
so I tried to attach the CameraController script, which is below, tried to attach it to Main Camera, but doesnt move the view… tried to attach it to Player Canvas… weird thing happens, it just falls down (the y coordinate just goes crazy and falls to the negatives)… then tried attaching the CameraController script to Main - Canvas… still nothing happens… Tried to attach the Camera Controller script to PlayerCanvas, but I slightly move the joystick, and flies everywhere… but the playerCanvas flies, but i still see the screen centered… I am at a loss here
please help

Maybe you can show us the script too. This maybe helps!
ugh idiot me, ya that would help right?
CameraController script below:
public class CameraController : MonoBehaviour
{
public Transform target;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position = new Vector3(target.transform.position.x, target.transform.position.y, target.transform.position.z);
}
}
Are you saying the Canvas doesn’t move when you move the Main Camera? The Canvas is attached to the screen by default, so it wouldn’t move along with it. You can change the settings of it by changing Render Mode in the Canvas settings. If you would like it to remain in the world, you would need to change the setting to World Space.
Ya, the canvas doesn’t move, ok cool thanks, that sorta worked… however now what is happening is… the HouseCanvas goes along with the PlayerCanvas, I set both to World Space, and they both take off quick when moving the joystick… BUT when I set the HouseCanvas to ScreenSpace - Overlay, the PlayerCanvas disappears…
so my goal is to have a top down player moving the camera, no offset… so what is happening now… for the PlayerCanvas, that has the player, and the joystick to move when the joystick is moved… but the HouseCanvas to stay… I tried to maybe remove the Background_Image from HouseCanvas… but just disappears, so it seems I need a canvas no matter what, this is what I have now… hopefully I am getting close… but any thoughts?

So I tried to change the Canvas to World Space, it SORTA works… however I can only go one direction… Up and to the Right… even if I press the joystick down, it still makes the joystick Stick to Up and to the right… very weird… BUT it is sorta working how I want it… its just the joystick is not functioning right, I am using the free joystick control from Package Manager and using the prefab… not sure if anyone recommends to use it or not? or maybe another joystick preference?
If you use this: Joystick Pack | Input Management | Unity Asset Store
then it’s right. I use the same package and works fine for me. I think if the joystick not work, watch a quick tutorial about it, so maybe your joystick script is false.
Hey glgamesforfun, thanks for your reply, Ya I am using that joystick asset/prefab “Fixed Joystick” prefab, I watched Brackeys, but i also simplified it, and also added a little logic to it, which if the player moves the joystick slightly… then go this speed, else moves the joystick more… then go faster, here is the joystick script below:
public CharacterController2D controller;
public Joystick joyStick;
public float moveSpeed = 40.0f;
public float fastSpeed = 80.0f;
private Vector3 input;
public void Update()
{
input = new Vector3(joyStick.Horizontal, joyStick.Vertical);
if (input.magnitude >= 0.5f) // fast
{
Vector3 velocity = input.normalized * fastSpeed;
transform.position += velocity * Time.deltaTime;
}
else if (input.magnitude >= 0.1f) // slow
{
Vector3 velocity = input.normalized * moveSpeed;
transform.position += velocity * Time.deltaTime;
}
}
so just double checked again… when I change the canvas, Render Mode, set it to world space, it goes crazy, joystick sticks to top right, the character flies off… but go back to Screen space - camera, right away, the screen and everything else literally falls or drops down, and I have no gravity set… so I am puzzled there…
I then try the only thing that is not going crazy… screen space - overlay… and the only thing I can move is the character/player with the joystick… but the screen stays… so back to square one 
I am at a loss here…
Also wanted to ask… I do have the character and background as image… and thinking of setting them as “Sprite Renderer” but that poses more problems… as the sprite renderer, I cant resize the image… any ideas, maybe I need to do sprite renderer? but if I do… my characters are HUUUUUUUUUGE and background is small, and the joystick/buttons would be a mix, the joystick is image so would require canvas and back to square one…
Here you have a Vector3, but only x and y (joyStick.Horizontal, joyStick.Vertical). Maybe you need to add the z value with 0. Am I right?
Hey glgamesforfun, yes good catch, but i just tried adding the z value or -1 or something, sadly still the same :(… but I think I did get some progress…
So not sure if this makes sense, but I am still doing testing today and tomorrow to see if its working but…
what I did so far, is made 2 canvas, 1 is for the background or the world, and 2 is for the character + controls…
for the character + controls canvas, aka player Canvas, i set it to screen space - overlay, BUT, on the second canvas that has the background and stuff… I set that to World Space… and it seems to be almost working, but the character still goes slightly off screen a little but now I think I see the camera moving, or i should say the Player canvas that has the controls and player character moving across the Background Canvas that is set to World Space… just need to figure out how to stop the character from moving but have only the canvas moving instead of the character… here is the script below for the camera controller:
public Transform target;
public Canvas playerCanvas;
public GameObject uiPanel;
//Camera camera = Camera.main;
// Update is called once per frame
void Update()
{
//transform.LookAt(transform.position + camera.transform.rotation * Vector3.back, camera.transform.rotation * Vector3.up);
transform.position = new Vector3(target.transform.position.x, target.transform.position.y,-10);
//uiPanel.transform.position = new Vector3(target.transform.position.x, target.transform.position.y);
//playerCanvas.transform.position = new Vector3(target.transform.position.x, target.transform.position.y);
}