Developer Notes

Marked as by design because the input is pass-by-reference, and we don't want functions to be able to reassign 'self' to point at something else.


A Pass-by-Reference function input cannot accept a reference to Self.

Workaround: Cast from Self to the desired class and use that for the function's input.

Steps to Reproduce

1. Open any project
2. Create a new Actor Blueprint (ClassA)
3. Create a new Actor Blueprint (ClassB)
4. In ClassA, create a function
5. Give the function an Input of type ClassB Object Reference
6. Make the input Pass-by-Reference
7. In ClassB, create a variable of type ClassA
8. Get ClassA
9. Call the function from ClassA
10. Attach a reference to Self to the function's input
11. Attach the function to an Event Begin Play node
12. Compile

Error: Cannot pass a read-only variable to a reference parameter

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

Login to Vote

By Design
ComponentUE - Gameplay - Blueprint
Affects Versions4.6.14.8
CreatedDec 30, 2014
ResolvedMay 28, 2015
UpdatedJul 14, 2021