# Soft reference in interfaces creates hard reference dependecy

**URL:** <https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734>\
**Category:** Blueprint\
**Tags:** interfaces, unreal-engine, Blueprint, question\
**Created:** [June 5, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734 "2024-06-05T12:10:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheFlyingEpergne](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theflyingepergne/32/945825_2.png) [@TheFlyingEpergne](https://forums.unrealengine.com/u/TheFlyingEpergne)\
**Post date:** [June 5, 2024, 12:10pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/1 "2024-06-05T12:10:47Z")

</div>

I have a BPI\_Interact interface

This is what it looks like in the reference viewer with no references and therefore no dependencies

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/1/d212bd985ca2948a001045e79b3c1c37b9303892.png)

When I add a SOFT reference, the reference viewer now looks [like this](https://prnt.sc/bsZkUio4Nkix)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/a/8ea3b70a5a1874b03260cd703f1e450d3928f0ac.png)

**Why???**

PS: posting links to images as well as images because sometimes images disappear

---

<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:** [June 5, 2024, 12:19pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/2 "2024-06-05T12:19:17Z")

</div>

Try just using type ‘actor’ 🙂 ( then you can just use a hard ref )

This is because interfaces decouple things without the need for soft refs.

---

<div class="post-metadata">

**Author:** ![TheFlyingEpergne](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theflyingepergne/32/945825_2.png) [@TheFlyingEpergne](https://forums.unrealengine.com/u/TheFlyingEpergne)\
**Post date:** [June 5, 2024, 12:59pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/3 "2024-06-05T12:59:31Z")

</div>

Ok that works but it confuses me haha

So like you said, I’ve changed the `BP_Character` interface reference to `Actor` (not a soft reference in the interface)

Then over in my interactive prop blueprint (in this case a ladder), I implement the interact event, I can take the `Actor` reference, cast it as a `Character` and it’s still decoupled/not dependent/[doesn’t show up in the reference viewer](https://prnt.sc/4M3AmfSHDPeV) - this is **good** and expected based on your reply

> [@ClockworkOcean](#):
>
> Try just using type ‘actor’ 🙂 ( then you can just use a hard ref )
> 
> This is because interfaces decouple things without the need for soft refs.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/b/1bb22c789b2256d6f8dd39f74ca291f80e5da580.png)  
_No actor or character shown in the reference viewer_

**BUT** if I do the same thing and instead cast to `BP_Character` rather than `Character`, it **IS** coupled/dependent/[shows up in the reference viewer](https://prnt.sc/OclTbdoIA4QU)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/f/b3fd47e5b3991ba0622cf162ca5847faa7c2de25.png)  
_BP\_Character now shown in the reference viewer_

Are you able to explain to me why this is the case?

---

<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:** [June 5, 2024, 1:05pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/4 "2024-06-05T13:05:36Z")

</div>

The whole point of interfaces is, no more casting 🙂

When you cast, you will get dependencies. You have to talk to actors without casting.

Your ladder can’t access the character moment component. If it does, it ‘knows’ it’s a character and everything is lost.

You have 3 main options

1. The ladder just moves the player only by knowing it’s an actor

2. The ladder also uses an interface to get tell the player to do certain things

3. The player knows how to climb ladders only by knowing they are actors

---

<div class="post-metadata">

**Author:** ![TheFlyingEpergne](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theflyingepergne/32/945825_2.png) [@TheFlyingEpergne](https://forums.unrealengine.com/u/TheFlyingEpergne)\
**Post date:** [June 5, 2024, 1:22pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/5 "2024-06-05T13:22:00Z")

</div>

Hmm that turns this into more of a head scratcher than i anticipated. Thanks for your help!

---

<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:** [June 5, 2024, 1:24pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/6 "2024-06-05T13:24:14Z")

</div>

Yes, sorry, that’s the problem 🙂

If you have a tight coupling ( as it’s called ) between the player and the ladder, it means that the ladder concept ( including all textures, code etc ) is loaded all the time your player is loaded.

You _can_ still have a tight coupling if you have a special player you only load for traversing ladders. That’s a possibility. Many methods…

---

<div class="post-metadata">

**Author:** ![TheFlyingEpergne](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theflyingepergne/32/945825_2.png) [@TheFlyingEpergne](https://forums.unrealengine.com/u/TheFlyingEpergne)\
**Post date:** [June 5, 2024, 1:29pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/7 "2024-06-05T13:29:29Z")

</div>

Yes the coupling is exactly what I was hoping to avoid by using interfaces - but I was surprised to see that adding references as inputs on interface functions still leads to coupling anyway regardless of whether the reference is hard or soft🙄

---

<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:** [June 5, 2024, 1:31pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/8 "2024-06-05T13:31:11Z")

</div>

You basically can’t mention the type of an object in your blueprint. The moment you mention the type, you create a bond. Casting, and even just having a variable count as mentioning the type

You passed an actor reference, all good, but then you casted it, doh, game over 🙂

---

<div class="post-metadata">

**Author:** ![TheFlyingEpergne](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theflyingepergne/32/945825_2.png) [@TheFlyingEpergne](https://forums.unrealengine.com/u/TheFlyingEpergne)\
**Post date:** [June 5, 2024, 1:38pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/9 "2024-06-05T13:38:34Z")

</div>

So really the only stuff you can pass through an interface (if you want to avoid coupling) is [these](https://prnt.sc/gpz1PPYdUzHP)?

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/a/b0a576ca926458d37d6ca0de128ab4f310ed8142.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:** [June 5, 2024, 1:39pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/10 "2024-06-05T13:39:49Z")

</div>

Yup, just generic types.

---

<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:** [July 5, 2024, 1:40pm UTC](https://forums.unrealengine.com/t/soft-reference-in-interfaces-creates-hard-reference-dependecy/1890734/11 "2024-07-05T13:40:01Z")

</div>

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