I am making an online game project for the first time and I have made systems such as leaving the room, setting up a room, but when I click the "delete room" button, I want to delete the room and kick everyone in it. How can I do that?
i tried PhotonNetwork.CurrentRoom.isOpen = false and PhotonNetwork.CurrentRoom.isVisible = false didn't work.
Related
So i challenged myself to make a little game where you build a rocket and then you press the button it launches
i want to it to group up all of the objects and adds a placement script to the parent object all within a script i do not know if this is even possible in unity but if there are other methods or others that are better
using tags did not work i want to let them group up and launch!
Each time you instantiate a piece, cache a reference to it. When it's time to launch, use the first cached reference as the parent and then, for each other piece, set its parent to be the first piece. It'd look something like
for(int i=1; i<parts.Count; i++)
{
parts[i].transform.parent = parts[0].transform;
}
So I have a game built in Unity3D that has database access. Most of the URLS I have work fine in both editing and built versions. However, one type (a panel to display the player's current score of a level and the top 3 scores of that level) works perfectly in the editor, but when I compile it to anything else (web, standalone, droid...) it the panel loads and the name displays, but nothing is retrieved.
The only difference I can think of is that this panel opens up on a mouse over a button, while the other retrievals are automatic. Remember that when built, OTHER url retrievals work fine and display everything correctly, it's just this one panel that doesn't seem to work right. Any thoughts on what could be causing this?
The code is in C# if that matters. The database is MySQL with php.
Add Missing canCallRoutine
public void showScorePanal(){
scorePanel.gameObject.SetActive (true);
canCallCoroutine = true;
}
Without setting canCallCoroutine to true, you would not be guaranteed to fill the score field.
I need to interface with Xbox 360 controllers and my limited knowledge leaves me stuck with C#. I don't want to use XNA (and require users to have it installed) for this simple thing, so I'm using SlimDX to allow me to interface with XInput. I have been able to detect all button presses and the little program is coming along...but I need to know how to poll / know when a button is pressed, to then trigger events.
Right now I have a timer running at 10ms and it checks which buttons are pressed and behaves based on that. But let's say you press X for one second = it detects X was "pressed" 100 times because well, every 10ms, X was pressed. I want to fire up my events only when the button is pressed, and not have to depend on a timer.
Is it possible with SlimDX on C#? If so, how? If not, is there a better/lower latency XInput wrapper for C# that will do what I need?
Thanks in advance!
Create two variables to store the button's state between polls.
bool curretButtonState;//pressed == true
bool previousButtonState;
//poll each 10ms
void CheckInput()
{
currentButtonState = pollResult;
if(currentButtonState == true && previousButtonState == false)
{
//button just pressed, call code
}
if(currentButtonState== false && previousButtonState == true)//additional functionality if desired
{
//button just released, call other code
}
previousButtonState = currentButtonState;
}
Let's say it detects a button press and runs your appropriate code, then the next time it polls (10ms), since the previous state was toggled to true, and the button is still pressed, then both states will be true and it wont run the code the 2nd time. The 1st if statement will not be true again until the button is release and re-pressed.
I've created a custom window with a range of buttons. When a game objects are selected, and a button is pressed, the myPrefab value of the MyScript component of the selected game objects are set to a particular prefab (according to which button is pressed).
This is working up until the point where I press play. I may have 10 game objects with the MyScript component, and using the buttons set each of them to contain a particular prefab. In the inspector, I can see the prefab value has updated for each of the game objects.
However, as soon as I press the play button, any modifications made by the buttons is undone.
To clarify, if I set the prefab in the inspector, then with a button, it will revert to the one set in the inspector. If I simply set it by the inspector, it won't revert. If it is by default null, and only set by the buttons, it will revert to null. (Only the button results are being reverted).
Could anyone work out why this is the case? Is there some sort of confirm or save method I should be calling to "lock in" my choice?
Simply add "EditorUtility.SetDirty(component);" after the value is modified.
This marks the object as needing to be stored (instead of simply being the value shown in the editor).
In the inspector, things are marked as dirty as soon as you change them. Changing them through other editors like this however, means that the the object must manually be marked as dirty.
if (GUI.Button(rectangle, GUIContent.none))
{
foreach (GameObject go in Selection.gameObjects)
{
MyScript component = go.GetComponent<MyScript>();
if (component == null)
continue;
component.myPrefab = firstPrefab;
EditorUtility.SetDirty(component);
}
}
I know the question isn't very clear, I will try to explain, can't provide code because most of the variables are written in my language so you wouldn't be able to understand them.
I'm writing a simple software that maintains a list of cars, their owners and repairs made on the cars(I've developed 3 separate classes for cars, owners, and repairs). Important info is that each car has an attribute which is a list of repairs done to it, and my idea was as follows: I made a form which allows you to enter relevant data about the owner and the car and containing a checkbox saying Has repairs, and a button to add a new object to the list. When I click this button, it checks the status of the checkbox, if it is checked, a new form opens whose constructor receives references to a list and a car containing 2 buttons, 1 to exit the form, the other one to add repairs to the said list. But what happens is, I click the button, and it adds the car while the other form is still in the air, not doing what I need it to do, since the car is already in the list.
To be clear, I need a way to make the code execution stop when I enter this new form, and resume when I leave it. Any help would be welcome!
form1.Show() shows a form and continues execution once the form is opened.
Try form1.ShowDialog() - this makes the form modal, meaning it will hold code execution until you close the form.