NO MOM
I CANT PAUSE.
Scientific Number Tools Documentation
Support
Browse lessons

Test context with your own variables

Understand why a value can belong to a context.

Optional extension. It is not required to complete the core path.

On this page

Goal: Understand why a value can belong to a context.

Before you start: The Safe extension and a separate Actor.

Optional extension. Finish the core path first, then return when you need this capability.

The idea you will use

Reuse the GUID and name that identify the context. Creating another GUID to read does not reproduce the write context.

Predict before running

What happens when you write with Coins and read with Gems?

Build and check

  1. Create BP_MiContexto, of Actor type. Add a variable SaldoContexto of type Context Bound Safe Scientific Number.
  2. From BeginPlay, run Set Context-Bound Safe Number on this variable by reference, with In Value 1000 and Context Name Coins. For the GUID, run New Guid once from BeginPlay. Promote its output to a variable named DominioContexto. Connect New Guid output to the value input of Set DominioContexto. Connect execution as BeginPlay → Set DominioContexto → Set Context-Bound Safe Number. New Guid is pure: use it only to assign the variable; use Get DominioContexto for other operations. Connect a Get DominioContexto to the GUID pin. You do not need Make Guid or A/B/C/D fields. Check the returned bool.
  3. Then call Try Get Context-Bound Safe Number on the same variable, with Get DominioContexto on GUID and Coins on Context Name. Reuse the saved identifier: do not run New Guid again to read. On True, display Out Value through To Fixed String → Print String.
  4. Place an instance of this Actor and run: expect 1000.00. In the debugger, observe that the read returns True.
  5. Stop Play and change only the Context Name on the read to Gems. Run: it should return False. Do not also change the writer, or you would no longer be testing an incorrect context.
  6. Restore Coins. Add Rekey Context-Bound Safe Number between the write and read, using the correct context. The read should still return 1000.

Check your reasoning

See the explanation

The read fails because the context differs. The number has not become another resource.

Your turn: Restore the name, change only the read GUID, then restore the original.

Ready to continue when: you can explain which values must persist between writing and reading.

Back to the path and its extensions

No Mom I Cant Pause · Contact support · Discord

Scientific Number Tools 1.0.0 · Practical lessons ·