#Object reference not set to an instance
1 messages · Page 1 of 1 (latest)
you'd have to show your code now and the full error message
including the filename/line number of the error
this error means that PlanePrefab does not have PlaneScript attached to it
you need to make sure you put the PlaneScript on the prefab you assigned
show it
I thought about placeobjects
show screenshots of the inspectors of these objects
that's on a child object of the prefab
you're calling GetComponent on the root object
the one called BetterPlane
why did you put the script on a child obejct
when i made it to move by mouse dragging
the colider from the parent
didn't work
so i made it on the child
the parent its made by unity. if i don't use it
unity draws the plane in a single cell
what?
Put the script on the parent object
the script is not the same as the tilemap
I ll try immediately
a small question do you have any example of overlapbox function?
i don't understand what angles do
You mean 2D? Angle is the rotation of the box
yes
OverlapBox(Vector2 point, Vector2 size, float angle, ContactFilter2D contactFilter,
last argument its for the 2nd object collider
right?
no it's a contact filter
there is no "second" object because there isn't a first object either
not sure what you mean by second object
no it checks a box shaped area to see which object(s) are inside the box
ohhhh
and its returning an object list ?
with objects inside it?
or true/false
And the objects should be 100% in to return it?
depends which version you use
The docs are right here, with all of that information: https://docs.unity3d.com/ScriptReference/Physics2D.OverlapBox.html
no, any overlap will count
do you have any idea how could i see when the planes is totally in the matrix?
to move it 1by1 square
I have no idea what your gameplay is like
but this doesn't look like something I'd be using the physics engine for
it looks like something grid based
i would just iterate over each coordinate in the object and see if they're inside the square
if i made the objects from painting i can go through all tiles?
or i need to Instantiate all tiles in script?
I have no idea what that means