UnityEngine.Networking and EventTrigger problemScripting GUI buttons to trigger an event of changing materialsMove a 2D character in Unity with UI ButtonUnity multiplayer bullet spawn scriptHow to create a material picker option in unity?Unity: Can't access Childrens SpriteRenderer.enabledUnity OnMouseDown detect which button via Event TriggerGet VRTK input to set a value inside an animator controllerUnity UI buttonUnity multiplayer UI button script
Is it fair to ask my employer for personal laptop insurance?
Is there a real-world mythological counterpart to WoW's "kill your gods for power" theme?
What jurisdiction do Scottish courts have over the Westminster parliament?
Will replacing a fake visa with a different fake visa cause me problems when applying for a legal study permit?
Maintenance tips to prolong engine lifespan for short trips
Can I conceal an antihero's insanity - and should I?
Selecting 2 column in an Inner join
What exactly is a marshrutka (маршрутка)?
Why do sellers care about down payments?
Why don't I get the correct limit of a sequence, regardless of how I arrange it (the sequence), while following the rules for solving limits?
Is this WWI movie scene realistic?
Why would "an mule" be used instead of "a mule"?
Uncovering the Accelerated Dragon opening
Is low emotional intelligence associated with right-wing and prejudiced attitudes?
Is there a reliable way to hide/convey a message in vocal expressions (speech, song,...)
How to say "quirky" in German without sounding derogatory?
Are Democrats more likely to believe Astrology is a science?
When was the earliest opportunity the Voyager crew had to return to the Alpha quadrant?
Are scroll bars dead in 2019?
Is English tonal for some words, like "permit"?
How to run Death House for 3 new players with no healer?
Evidence that matrix multiplication cannot be done in O(n^2 poly(log(n))) time
Why should I always enable compiler warnings?
What is my breathable atmosphere composed of?
UnityEngine.Networking and EventTrigger problem
Scripting GUI buttons to trigger an event of changing materialsMove a 2D character in Unity with UI ButtonUnity multiplayer bullet spawn scriptHow to create a material picker option in unity?Unity: Can't access Childrens SpriteRenderer.enabledUnity OnMouseDown detect which button via Event TriggerGet VRTK input to set a value inside an animator controllerUnity UI buttonUnity multiplayer UI button script
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a multiplayer 2D game made in Unity and I wanted to put some onscreen buttons to be able to control it on the telephone. The problem is that when I put the Event Trigger on the button it uses the function from the script that has to use and the functions that are called within it, but it can't open [Command] functions at all. Any idea why does this happen?
The Button with the Event Trigger looks like this:
https://ibb.co/mBHQ9wM
The Event Trigger uses the function TouchInput - function ShootButton (as it can be seen from the picture TouchInput.Button)
The TouchInput function looks like this:
https://pastebin.com/TWe8Mws1
The TouchInput opens the PlayerController script and uses the function "TryFireBullet()". The important functions look like this:
public void TryFireBullet()//(NetworkIdentity id)
Time.time > ultimul_glont + Delay_Bullet)
//
ultimul_glont = Time.time;
Debug.Log("works2");
//id.AssignClientAuthority();
CmdFireBullet();
//
public void TryFireBullet2() // de_sters
Debug.Log("LEL");
[Command]
public void CmdFireBullet()
Debug.Log("works3");
GameObject bullet = Instantiate(bulletPrefab, gunTip.position, Quaternion.identity) as GameObject;
NetworkServer.Spawn(bullet);
//NetworkServer.SpawnWithClientAuthority(bullet, connectionToClient);
RpcAdaugaViteza(bullet);
[ClientRpc]
public void RpcAdaugaViteza(GameObject bullet)
Debug.Log("MERGE_ADAUGA_VITEZA");
Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
bullet.GetComponent<BulletScript>().creator = gameObject;
rb.velocity = new Vector2(bulletSpeed * Mathf.Sign(transform.localScale.x), 0f);
Full code of PlayerController script here: https://pastebin.com/R0q7usY7
When I press the Button the Debug shows me:
- "cevaShootButton"
- "works"
- "LEL"
- "works2"
It does not enter in the [Command] function, or the Debug from this function does not print because it is executed on the server? Probably the first one because I can shoot bullets very well without a button using a keyboard key and it also prints "works3" when I do this.
Can you tell me why the button cannot open [Command] functions or how can I replace this type of function?
Thanks.
unity3d server
add a comment |
I have a multiplayer 2D game made in Unity and I wanted to put some onscreen buttons to be able to control it on the telephone. The problem is that when I put the Event Trigger on the button it uses the function from the script that has to use and the functions that are called within it, but it can't open [Command] functions at all. Any idea why does this happen?
The Button with the Event Trigger looks like this:
https://ibb.co/mBHQ9wM
The Event Trigger uses the function TouchInput - function ShootButton (as it can be seen from the picture TouchInput.Button)
The TouchInput function looks like this:
https://pastebin.com/TWe8Mws1
The TouchInput opens the PlayerController script and uses the function "TryFireBullet()". The important functions look like this:
public void TryFireBullet()//(NetworkIdentity id)
Time.time > ultimul_glont + Delay_Bullet)
//
ultimul_glont = Time.time;
Debug.Log("works2");
//id.AssignClientAuthority();
CmdFireBullet();
//
public void TryFireBullet2() // de_sters
Debug.Log("LEL");
[Command]
public void CmdFireBullet()
Debug.Log("works3");
GameObject bullet = Instantiate(bulletPrefab, gunTip.position, Quaternion.identity) as GameObject;
NetworkServer.Spawn(bullet);
//NetworkServer.SpawnWithClientAuthority(bullet, connectionToClient);
RpcAdaugaViteza(bullet);
[ClientRpc]
public void RpcAdaugaViteza(GameObject bullet)
Debug.Log("MERGE_ADAUGA_VITEZA");
Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
bullet.GetComponent<BulletScript>().creator = gameObject;
rb.velocity = new Vector2(bulletSpeed * Mathf.Sign(transform.localScale.x), 0f);
Full code of PlayerController script here: https://pastebin.com/R0q7usY7
When I press the Button the Debug shows me:
- "cevaShootButton"
- "works"
- "LEL"
- "works2"
It does not enter in the [Command] function, or the Debug from this function does not print because it is executed on the server? Probably the first one because I can shoot bullets very well without a button using a keyboard key and it also prints "works3" when I do this.
Can you tell me why the button cannot open [Command] functions or how can I replace this type of function?
Thanks.
unity3d server
add a comment |
I have a multiplayer 2D game made in Unity and I wanted to put some onscreen buttons to be able to control it on the telephone. The problem is that when I put the Event Trigger on the button it uses the function from the script that has to use and the functions that are called within it, but it can't open [Command] functions at all. Any idea why does this happen?
The Button with the Event Trigger looks like this:
https://ibb.co/mBHQ9wM
The Event Trigger uses the function TouchInput - function ShootButton (as it can be seen from the picture TouchInput.Button)
The TouchInput function looks like this:
https://pastebin.com/TWe8Mws1
The TouchInput opens the PlayerController script and uses the function "TryFireBullet()". The important functions look like this:
public void TryFireBullet()//(NetworkIdentity id)
Time.time > ultimul_glont + Delay_Bullet)
//
ultimul_glont = Time.time;
Debug.Log("works2");
//id.AssignClientAuthority();
CmdFireBullet();
//
public void TryFireBullet2() // de_sters
Debug.Log("LEL");
[Command]
public void CmdFireBullet()
Debug.Log("works3");
GameObject bullet = Instantiate(bulletPrefab, gunTip.position, Quaternion.identity) as GameObject;
NetworkServer.Spawn(bullet);
//NetworkServer.SpawnWithClientAuthority(bullet, connectionToClient);
RpcAdaugaViteza(bullet);
[ClientRpc]
public void RpcAdaugaViteza(GameObject bullet)
Debug.Log("MERGE_ADAUGA_VITEZA");
Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
bullet.GetComponent<BulletScript>().creator = gameObject;
rb.velocity = new Vector2(bulletSpeed * Mathf.Sign(transform.localScale.x), 0f);
Full code of PlayerController script here: https://pastebin.com/R0q7usY7
When I press the Button the Debug shows me:
- "cevaShootButton"
- "works"
- "LEL"
- "works2"
It does not enter in the [Command] function, or the Debug from this function does not print because it is executed on the server? Probably the first one because I can shoot bullets very well without a button using a keyboard key and it also prints "works3" when I do this.
Can you tell me why the button cannot open [Command] functions or how can I replace this type of function?
Thanks.
unity3d server
I have a multiplayer 2D game made in Unity and I wanted to put some onscreen buttons to be able to control it on the telephone. The problem is that when I put the Event Trigger on the button it uses the function from the script that has to use and the functions that are called within it, but it can't open [Command] functions at all. Any idea why does this happen?
The Button with the Event Trigger looks like this:
https://ibb.co/mBHQ9wM
The Event Trigger uses the function TouchInput - function ShootButton (as it can be seen from the picture TouchInput.Button)
The TouchInput function looks like this:
https://pastebin.com/TWe8Mws1
The TouchInput opens the PlayerController script and uses the function "TryFireBullet()". The important functions look like this:
public void TryFireBullet()//(NetworkIdentity id)
Time.time > ultimul_glont + Delay_Bullet)
//
ultimul_glont = Time.time;
Debug.Log("works2");
//id.AssignClientAuthority();
CmdFireBullet();
//
public void TryFireBullet2() // de_sters
Debug.Log("LEL");
[Command]
public void CmdFireBullet()
Debug.Log("works3");
GameObject bullet = Instantiate(bulletPrefab, gunTip.position, Quaternion.identity) as GameObject;
NetworkServer.Spawn(bullet);
//NetworkServer.SpawnWithClientAuthority(bullet, connectionToClient);
RpcAdaugaViteza(bullet);
[ClientRpc]
public void RpcAdaugaViteza(GameObject bullet)
Debug.Log("MERGE_ADAUGA_VITEZA");
Rigidbody2D rb = bullet.GetComponent<Rigidbody2D>();
bullet.GetComponent<BulletScript>().creator = gameObject;
rb.velocity = new Vector2(bulletSpeed * Mathf.Sign(transform.localScale.x), 0f);
Full code of PlayerController script here: https://pastebin.com/R0q7usY7
When I press the Button the Debug shows me:
- "cevaShootButton"
- "works"
- "LEL"
- "works2"
It does not enter in the [Command] function, or the Debug from this function does not print because it is executed on the server? Probably the first one because I can shoot bullets very well without a button using a keyboard key and it also prints "works3" when I do this.
Can you tell me why the button cannot open [Command] functions or how can I replace this type of function?
Thanks.
unity3d server
unity3d server
asked Mar 28 at 9:26
Vlad6001Vlad6001
74 bronze badges
74 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
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/4.0/"u003ecc by-sa 4.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%2f55394101%2funityengine-networking-and-eventtrigger-problem%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
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%2f55394101%2funityengine-networking-and-eventtrigger-problem%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