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.
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
Results:
Error: Cannot pass a read-only variable to a reference parameter
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.6.1, 4.8 |
Created | Dec 30, 2014 |
---|---|
Resolved | May 28, 2015 |
Updated | Jul 14, 2021 |