Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
In my game, I have a script for switching weapons. The script relies on activating and deactivating gameObjects that you have picked up. As of now, the gameObjects get set inactive in unity, but the function activeSelf returns true no matter the actual state. A part of my script is attached. The If-statement works well and I can monitor the state in Debug.Log.
This should not be happening, and I have no idea what's the cause.
You control activity of weapon.gameObject, but then you check gameObject
gameObject.activeSelf returns same result every time because you don’t change it actually. You change weapon.gameObject.selfActive
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 months ago.
Improve this question
I want to know how to create a windows label that looks like this:
I tried to find a tool from the toolbox to create a label looks like that.But couldn't found.
As stated in the comments, that is a GroupBox with two RadioButtons in it:
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
In php, it is possible to directly call a method on a newly created class instance.
(new MyClass())->classMethod();
Is it possible to do this in C#?
Yes, possible, although I am not sure why you need to do it (it is not recommended).
new MyClass().CallMethod();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have a event whose publish method has a signature as follows:
publish((string moduleName,object moduleData) payload)
I have a set up a mockEventAggregator and other necessary setups but I need to verify if it has been called once.
I am having a tough time trying to write the verify statement as the parameter seems a bit complex and confusing to me on how to implement it, as I'm not able to get the syntax right.
here's what I'm trying:
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>(), Times.Once));
You have wrong brackets. Move one bracket from the end after It.IsAny<(string,object)>()
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>()), Times.Once);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I am using unity 5.5.03f and I want to reload a screen once the character hits an obstacle, I do have the box colliders attached to both. But the code that I have is not working.
This is the code that I have for restarting the screen:
using UnityEngine.SceneManagement;
.
.
.
void onCollisionEnter2D(Collision2D collision){
// get the current scene name
string sceneName = SceneManager.GetActiveScene().name;
// load the same scene
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
}
I am using C# as my programming language for unity.
Any help and advice will be highly appreciated.
The code is fine.
But the function name would be OnCollisionEnter2D, not onCollisionEnter2D
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I just debugged my latest application, which reads content of txt files and shows them in a DataGrid. Unfortunately, if I debug my script, it is just shown in the Windows Taskbar with the preview of the application, but it does not display on screen. I cannot see it. Can you tell me why?
It is the only application. All my other applications work well.
EDIT: I use own settings for displaying my window. The window position was set to -32000 and -32000. That was my fault. Thank you!
Did you set your forms WindowsState to Minimized , maybe ?
If so change it back to Normal and it will show up.