My Boolean In Another Script Won't Change State
thank you for reading this. I am quite confused why for some reason this code will not set live round to true when the laser spawns, but it will set the spawn origin to the correct game object and detach it from the parent, anyone got anything? And before you ask, no I don't set live round to false anywhere until I destroy the laser itself.
Thank you for any help you have!
private void Start()
{
if (gameObject.name == "Big Laser(Clone)")
{
spawnOrigin = GetComponentInParent<BigShip>();
spawnOrigin.liveRound = true;
transform.parent = null;
}
}
c# unity3d boolean
add a comment |
thank you for reading this. I am quite confused why for some reason this code will not set live round to true when the laser spawns, but it will set the spawn origin to the correct game object and detach it from the parent, anyone got anything? And before you ask, no I don't set live round to false anywhere until I destroy the laser itself.
Thank you for any help you have!
private void Start()
{
if (gameObject.name == "Big Laser(Clone)")
{
spawnOrigin = GetComponentInParent<BigShip>();
spawnOrigin.liveRound = true;
transform.parent = null;
}
}
c# unity3d boolean
2
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value ofliveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.
– dlatikay
Nov 24 '18 at 21:42
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10
add a comment |
thank you for reading this. I am quite confused why for some reason this code will not set live round to true when the laser spawns, but it will set the spawn origin to the correct game object and detach it from the parent, anyone got anything? And before you ask, no I don't set live round to false anywhere until I destroy the laser itself.
Thank you for any help you have!
private void Start()
{
if (gameObject.name == "Big Laser(Clone)")
{
spawnOrigin = GetComponentInParent<BigShip>();
spawnOrigin.liveRound = true;
transform.parent = null;
}
}
c# unity3d boolean
thank you for reading this. I am quite confused why for some reason this code will not set live round to true when the laser spawns, but it will set the spawn origin to the correct game object and detach it from the parent, anyone got anything? And before you ask, no I don't set live round to false anywhere until I destroy the laser itself.
Thank you for any help you have!
private void Start()
{
if (gameObject.name == "Big Laser(Clone)")
{
spawnOrigin = GetComponentInParent<BigShip>();
spawnOrigin.liveRound = true;
transform.parent = null;
}
}
c# unity3d boolean
c# unity3d boolean
asked Nov 24 '18 at 20:45
HagwillHagwill
227
227
2
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value ofliveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.
– dlatikay
Nov 24 '18 at 21:42
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10
add a comment |
2
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value ofliveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.
– dlatikay
Nov 24 '18 at 21:42
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10
2
2
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value of
liveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.– dlatikay
Nov 24 '18 at 21:42
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value of
liveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.– dlatikay
Nov 24 '18 at 21:42
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10
add a comment |
1 Answer
1
active
oldest
votes
If you sure didn't change your variable in code, I think this problem here is you get component spawnOrigin not correct. Just check spawnOrigin is correct component you want to get by Debug.Log or set break point in visual studio.
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462213%2fmy-boolean-in-another-script-wont-change-state%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you sure didn't change your variable in code, I think this problem here is you get component spawnOrigin not correct. Just check spawnOrigin is correct component you want to get by Debug.Log or set break point in visual studio.
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
add a comment |
If you sure didn't change your variable in code, I think this problem here is you get component spawnOrigin not correct. Just check spawnOrigin is correct component you want to get by Debug.Log or set break point in visual studio.
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
add a comment |
If you sure didn't change your variable in code, I think this problem here is you get component spawnOrigin not correct. Just check spawnOrigin is correct component you want to get by Debug.Log or set break point in visual studio.
If you sure didn't change your variable in code, I think this problem here is you get component spawnOrigin not correct. Just check spawnOrigin is correct component you want to get by Debug.Log or set break point in visual studio.
answered Nov 25 '18 at 3:16
Trung BuiTrung Bui
913
913
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
add a comment |
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
I did check it via the print function and even made the spawn origin public as to be able to click it in the editor and see what it is cached to and everything seems correct... Thanks for the help though!
– Hagwill
Nov 25 '18 at 9:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462213%2fmy-boolean-in-another-script-wont-change-state%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
unity is not my domain of knowledge, but I can tell you nobody will be able to guess what happens in other parts of your code. please debug your program (there are watches which will break into the debugger whenever the value of
liveRound
changes, for example), then provide a minimal, complete example so the problem could be reproduced.– dlatikay
Nov 24 '18 at 21:42
@dlatikay Good call debugging it with vs, it never occurred to me to do that when using unity. I'll try that and come back with more info
– Hagwill
Nov 25 '18 at 9:01
Thank you so much, god do I feel stupid for not using vs debugging. You have saved me a lot of frustration and time my friend all the best to you @dlatikay!
– Hagwill
Nov 25 '18 at 10:10