Ramu.Utils.isInsideOfCanvas - HermesPasser/Ramu GitHub Wiki
static bool
Ramu.Utils.isInsideOfCanvas(gameObject)
Parameters
gameObject
gameObject: gameObject to be checked.
Return
bool
: Return true if the gameObj is inside of the canvas and false if not.
Description
Checks if the part of gameObject size (x,y,w,h) is inside of the canvas.
You can test this snippet of code here.
let gameobj = new GameObj(1, 2, 4, 4);
if (Ramu.Utils.isInsideOfCanvas(gameobj)){
new Text('gameobj is inside', 10, 10, 100);
} else {
new Text('gameobj is not', 10, 50, 100);
}
let gameobj2 = new GameObj(500, 500, 4, 4);
if (Ramu.Utils.isInsideOfCanvas(gameobj2)){
new Text('gameobj2 is inside', 10, 10, 100);
} else {
new Text('gameobj2 is not', 10, 50, 100);
}
See also Ramu.Utils.isOutOfCanvas