# Why am I getting this error?

**URL:** <https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [August 23, 2023, 7:12pm UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201 "2023-08-23T19:12:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 23, 2023, 7:12pm UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/1 "2023-08-23T19:12:14Z")

</div>

![image-1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/1/0b1aa9073f394abb64469d8b65a3cefdf7760e3d.png)

 ![image-2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/a/37a03ad0f5d0889265cf11c1a83f218d2703a1ed.png)

---

<div class="post-metadata">

**Author:** ![Twin01](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/twin01/32/1077777_2.png) [@Twin01](https://forums.unrealengine.com/u/Twin01)\
**Post date:** [August 23, 2023, 7:23pm UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/2 "2023-08-23T19:23:44Z")

</div>

You’ll need to post the `OrderCanvas()` function as well in order to see the issue.

---

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 23, 2023, 7:39pm UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/3 "2023-08-23T19:39:58Z")

</div>

```auto
    OrderCanvas() : canvas =
        MyCanvas : canvas = canvas:
            Slots := array:
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.4}, Maximum := vector2{X := 1.0, Y := 0.4}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget1
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.5}, Maximum := vector2{X := 1.0, Y := 0.5}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget2
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.6}, Maximum := vector2{X := 1.0, Y := 0.6}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget3
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.7}, Maximum := vector2{X := 1.0, Y := 0.7}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget4
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.8}, Maximum := vector2{X := 1.0, Y := 0.8}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget5

        PlayerUI.AddWidget(MyCanvas)

```

Also, that PlayerUI on the last line also gives an error: Unknown identifier

---

<div class="post-metadata">

**Author:** ![MoSchmo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MoSchmo](https://forums.unrealengine.com/u/MoSchmo)\
**Post date:** [August 24, 2023, 7:34am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/4 "2023-08-24T07:34:36Z")

</div>

Hello. You are trying to pass the variable **Player** to the OrderCanvas() function on line _126_, but OrderCanvas() is defined as a function which takes no parameters. To fix this issue, take a look below:

```auto
   #Function now takes a player type parameter
   OrderCanvas(Player: player) : canvas =
        MyCanvas : canvas = canvas:
            Slots := array:
#....

```

Give that a try, and post any other problems you may run into.

---

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 24, 2023, 8:14am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/5 "2023-08-24T08:14:43Z")

</div>

@MoSchmo  
Seems like I’m not getting errors there anymore but still PlayerUI at the bottom gets the same error

---

<div class="post-metadata">

**Author:** ![MoSchmo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MoSchmo](https://forums.unrealengine.com/u/MoSchmo)\
**Post date:** [August 24, 2023, 8:49am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/6 "2023-08-24T08:49:03Z")

</div>

Now that you have passed the player as a parameter, you will need to get the player’s UI before you try adding a widget.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/e/fcef5f320944399ec8fb2892321ba7808369b768.png)

```auto
if(PlayerUI := GetPlayerUI[Player]):
   PlayerUI.AddWidget(MyCanvas)   

```

All be sure to include the appropriate import path if you haven’t already.

```auto
using {/UnrealEngine.com/Temporary/UI}

```

Give that a shot.

---

<div class="post-metadata">

**Author:** ![nelmi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nelmi/32/746978_2.png) [@nelmi](https://forums.unrealengine.com/u/nelmi)\
**Post date:** [August 24, 2023, 9:04am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/7 "2023-08-24T09:04:20Z")

</div>

I already have that module. I was trying to find out where to put that if(PlayerUI …) snippet but I couldn’t find out where, can you point that out.

```auto
    # Order Widgets
    var OrderWidget1 : text_block = text_block{}
    var OrderWidget2 : text_block = text_block{}
    var OrderWidget3 : text_block = text_block{}
    var OrderWidget4 : text_block = text_block{}
    var OrderWidget5 : text_block = text_block{}

    # Order Messages
    Order1UI<localizes>(OrderInfo1:string) : message = "pending 1"
    Order2UI<localizes>(OrderInfo2:string) : message = "pending 2"
    Order3UI<localizes>(OrderInfo3:string) : message = "pending 3"
    Order4UI<localizes>(OrderInfo4:string) : message = "pending 4"
    Order5UI<localizes>(OrderInfo5:string) : message = "pending 5"

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        # TODO: Replace this with your code

        var players:[]player = Self.GetPlayspace().GetPlayers()
        if (ValidPlayer := players[0]):
            OrderCanvas(ValidPlayer)
        

    OrderCanvas(Player:player) : canvas =
        MyCanvas : canvas = canvas:
            Slots := array:
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget1
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.5}, Maximum := vector2{X := 1.0, Y := 0.5}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget2
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.6}, Maximum := vector2{X := 1.0, Y := 0.6}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget3
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.7}, Maximum := vector2{X := 1.0, Y := 0.7}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget4
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.8}, Maximum := vector2{X := 1.0, Y := 0.8}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget5
        return MyCanvas

```

---

<div class="post-metadata">

**Author:** ![MoSchmo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MoSchmo](https://forums.unrealengine.com/u/MoSchmo)\
**Post date:** [August 24, 2023, 9:23am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/8 "2023-08-24T09:23:39Z")

</div>

I would add it in the OrderCanvas() function. Indentation is also important, so make sure that is done properly.

```auto
    OnBegin<override>()<suspends>:void=
        # TODO: Replace this with your code

        var players:[]player = Self.GetPlayspace().GetPlayers()
        if (ValidPlayer := players[0]):
            OrderCanvas(ValidPlayer)
        

    OrderCanvas(Player:player) : canvas =
        MyCanvas : canvas = canvas:
            Slots := array:
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget1
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.5}, Maximum := vector2{X := 1.0, Y := 0.5}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget2
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.6}, Maximum := vector2{X := 1.0, Y := 0.6}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget3
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.7}, Maximum := vector2{X := 1.0, Y := 0.7}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget4
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 1.0, Y := 0.8}, Maximum := vector2{X := 1.0, Y := 0.8}}
                    Offsets := margin{Top := 0.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.5, Y := 0.5}
                    SizeToContent := true
                    Widget := OrderWidget5 
        #Add here
        if(PlayerUI := GetPlayerUI[Player]):
            PlayerUI.AddWidget(MyCanvas) 
        return MyCanvas

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 23, 2023, 9:24am UTC](https://forums.unrealengine.com/t/why-am-i-getting-this-error/1270201/9 "2023-09-23T09:24:30Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
