# Two button Switch system

**URL:** <https://forums.unrealengine.com/t/two-button-switch-system/481416>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 5, 2021, 1:23pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416 "2021-04-05T13:23:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 1:23pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/1 "2021-04-05T13:23:04Z")

</div>

Hello people!

I need help with this cuz I have been here struggling for three hours. I am trying to make a camera switch system. There are two buttons ( \< ; \> ) and when you press the “\>” button the camera goes from cam1 to cam2 and so on, so on… I tried to do this with variables but they repeat with “event tick” and I don’t know how else to trigger the update…

If you know , please help. Thank you!

 ![334788-uehelp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/2/3b2fe3b21a26d0c897ea51878a91edd5c3c260d0.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 1:41pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/2 "2021-04-05T13:41:17Z")

</div>

I don’t see any camera switching?

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 1:46pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/3 "2021-04-05T13:46:00Z")

</div>

Well, It works with integers. When the camera is activated, (The \> button) it adds a 1 to the value, Then, the timer switches it, Its the same thing with the \< button. The problem is the Event tick. When I want to add a switching animation, the sound and the animation play for x amounts of ticks…

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 1:48pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/4 "2021-04-05T13:48:49Z")

</div>

![334789-switch.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/9/269785bf32a6e8b832ec83a1747219d31768235a.png)

Something like this…

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 1:56pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/5 "2021-04-05T13:56:23Z")

</div>

![334790-helpue2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/2/94245315fbcdc09c69eac80d45ab31fad9f52756.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 1:56pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/6 "2021-04-05T13:56:36Z")

</div>

Tick is not the thing to use. Just use a custom event.

If you want to switch cameras instantaneously, you can just activate the next camera, otherwise you need to use SetViewTargetWithBlend.

If you use a view target, it might be best to have all your cameras ( except one ) as external actors.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 1:58pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/7 "2021-04-05T13:58:09Z")

</div>

What’s in cam switch?

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 2:10pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/8 "2021-04-05T14:10:49Z")

</div>

![334821-scr.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/6/42623ec208ec306e8952268938b70541ce0811a7.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 2:11pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/9 "2021-04-05T14:11:52Z")

</div>

Ah, so not an actual camera switch 🙂

Ok, so where is the event interact called from?

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 2:16pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/10 "2021-04-05T14:16:05Z")

</div>

![334823-interact.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/2/762c7402b97e6d89328e2d49fbf481ee590068c2.png)

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 3:09pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/11 "2021-04-05T15:09:56Z")

</div>

It’s just a normal line trace (Linetrace function is in the 3rd per. char.) and the function is used in the level blueprint… From there I use blueprint interface …

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 4:22pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/12 "2021-04-05T16:22:02Z")

</div>

Scratch that last comment.

Are you actually getting anything coming back from the character? Put a print string in the line trace to check it’s hitting something.

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 4:23pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/13 "2021-04-05T16:23:41Z")

</div>

It works… I have doors and they are working fine. This doesn’t tho. When I replace the EVENT INTERACT in the camera switch for EVENT TICK. It works. But I don’t want it to update every frame…

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 4:30pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/14 "2021-04-05T16:30:00Z")

</div>

I mean like this:

 ![334841-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/0/280a957cb457bf53c571738cdbb852a6490d55a4.jpeg)

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 4:31pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/15 "2021-04-05T16:31:13Z")

</div>

It won’t print it, But when I put Event tick, it works…

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 4:34pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/16 "2021-04-05T16:34:14Z")

</div>

Ok, time to let go of the tick idea 😉

I think that maybe…

The actor you’re getting back from the trace isn’t the same as the actor with the event in ( put a print in the trace to give you the hit actor name ).

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 4:35pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/17 "2021-04-05T16:35:58Z")

</div>

I know that the camera screen changes in the monitor actor and the two buttons are separate actors… I think I am going to scrap this whole idea and just stick to twenty buttons… Its easier but its more complicated.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 5, 2021, 4:37pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/18 "2021-04-05T16:37:14Z")

</div>

The way you’re doing it is fine, you’re just not connecting for some reason.

Print out the hit actor in the line trace, it’s the easiest way to find out what’s going on.

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 5, 2021, 4:44pm UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/19 "2021-04-05T16:44:53Z")

</div>

The hit actor is identical to the buttons that I am pushing. The animation for the button press works so I don’t know what now

---

<div class="post-metadata">

**Author:** ![tripolko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tripolko](https://forums.unrealengine.com/u/tripolko)\
**Post date:** [April 6, 2021, 6:02am UTC](https://forums.unrealengine.com/t/two-button-switch-system/481416/20 "2021-04-06T06:02:15Z")

</div>

Ok, so the solution? I made another model and made it with 20 buttons (1 for each camera ) and switching is much easier than making the right and left buttons… Thank you for helping me 😃
