Mine is 2D app.
The player moves only up and down.
The screen has a ground sprite. Its height is 300 pixels(0.3f).
I want to keep this player to be within the screen, because it flies out of the upper border of the screen.
When I click the play button, the debugging in console says;
‘error cs0118: UnityEngine.Component.transform’ is a 'property but a ‘type was expected’
How to fix this? Your help will be very appreciated.
The script as follows;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Boundary: Monobehaviour
{
public transform target;
Camera cam;
Vector3 pos = Camera.WorldToViewportPoint(transform.position);
I replaced “t” by “T” according to your instruction, but no changes.
And I don’t understand what the “unsing target” means. Where to use it?
Please let me know it in detailed scripts.
I am sorry for not putting code in code tags. I did not know that. I will do it in the future thread.
And I don’t understand why there is a duplicate of this thread. Probably because of my mistake.
I want to delete the duplicate, if possible ,or you can delete the duplicate.
Anyway,I corrected the script according to your above instruction, not any change but the same situation.