Hello, I made a game in unity using some 3d objects and C# as the coding language.
The game is working fine in unity, but when I build it for web or windows platform the, build crashes.
according to error log of the crash (windows build)
the only line i could understand is “Read from location 0000004c caused an access violation”.
Please help me.
how can i build it and what might be the exact problem ?
Thanx
An object or variable that you’re trying to access doesn’t exist, so it’s returning a NULL pointer as its memory address.
If it was a null reference from your script, it would raise an exception that is safely caught by the unity engine. Means that this is probably a bug in the unity engine.
But i have recently solved a problem leading to similar crashes, happened when i tried to instantiate / reference an object of a generic class without specifying generic parameters. EG:
class StateMachine[of T(MonoBehaviour)]:
def constructor(parent as object):
.....
......
class Monster(MonoBehaviour):
machine = StateMachine(self)
.........
This was causing the crash even in the editor whenever i clicked on the object containing this component (causing it to load and construct - the stateMachine initializer is called in the constructor).
In this case, the solution would be to replace the instantiation with proper generic:
machine = StateMachine[of Monster](self)
As you have noticed, i am using boo, but it is (in this usage) very similar to C#… not sure if C# compiler would compile this code without generic parameter, nor if it’s a bug in the compiler or the unity engine.