Uncaught ReferenceError: Cannot access ‘Hotspot’ before initialization
by user 103054507105067008
Uncaught ReferenceError: Cannot access ‘Hotspot’ before initialization
by user 103054507105067008
@serializeable(Hotspot) public hotspots?: Hotspot[];
and the script is just another script called Hotspot that I have been using for a while
by user 103054507105067008
Is it empty in unity?
It was populated, I’ll try again
by user 103054507105067008
Tried again with a fresh array and it still happens, seems to be when there is an array of a component that is user made like my Hotspot.ts
by user 103054507105067008
Example
by user 103054507105067008
by user 103054507105067008
So you have an array of these components in unity? Can you print just console.log(this) in awake and check what the component contains?
The component with the array
Tried with
awake()
{
console.log(this.testers);
}
It doesn’t make it to awake to print it, as it hits the error from above before
by user 103054507105067008
Can you console log this object from your other script before you get the error?
As in make the hotspot console.log the controller script?
by user 103054507105067008
Problem is the array itself causes that error before Awake can print
by user 103054507105067008
Can you show the stacktrace? Not sure what causes this. Tried reproducing but so far its working as expected.
the line where it fails would be helpful too
Will try to see where to get that, how can I grab that in Chrome?
by user 103054507105067008
You can just expand the error (theres a little arrow left)
I can wrap up this project now for a repro, will make a copy
by user 103054507105067008
I get this with another instance where I have two scripts that reference each other
by user 103054507105067008