âThe Object you want to Instantiate is nullâ But it works, can I ignore the error?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
This has never happened to me so I'm a bit confused.
GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;
This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.
Can I ignore this error or is there some problem that I'm not seeing?
unity c#
New contributor
add a comment |Â
up vote
1
down vote
favorite
This has never happened to me so I'm a bit confused.
GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;
This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.
Can I ignore this error or is there some problem that I'm not seeing?
unity c#
New contributor
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
This has never happened to me so I'm a bit confused.
GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;
This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.
Can I ignore this error or is there some problem that I'm not seeing?
unity c#
New contributor
This has never happened to me so I'm a bit confused.
GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;
This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.
Can I ignore this error or is there some problem that I'm not seeing?
unity c#
unity c#
New contributor
New contributor
New contributor
asked 1 hour ago
IGClusterFck
61
61
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
If the object is instantiated, then the error is coming from another instance of the script â you might accidentally have a second copy in your scene.
You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.
You absolutely should not ignore this error.
At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
If the object is instantiated, then the error is coming from another instance of the script â you might accidentally have a second copy in your scene.
You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.
You absolutely should not ignore this error.
At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.
add a comment |Â
up vote
4
down vote
If the object is instantiated, then the error is coming from another instance of the script â you might accidentally have a second copy in your scene.
You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.
You absolutely should not ignore this error.
At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
If the object is instantiated, then the error is coming from another instance of the script â you might accidentally have a second copy in your scene.
You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.
You absolutely should not ignore this error.
At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.
If the object is instantiated, then the error is coming from another instance of the script â you might accidentally have a second copy in your scene.
You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.
You absolutely should not ignore this error.
At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.
edited 40 mins ago
answered 1 hour ago
DMGregoryâ¦
54.1k11100153
54.1k11100153
add a comment |Â
add a comment |Â
IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.
IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.
IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.
IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f164973%2fthe-object-you-want-to-instantiate-is-null-but-it-works-can-i-ignore-the-erro%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password