Page MenuHomeFeedback Tracker

GetGame().FindEntity() - Issue
Assigned, NormalPublic

Description

Hi Support,

I've run into an issue where GetGame().FindEntity() doesn't seem to work on entities that are outside of the layer that the script is called.

This script is being called from a component on a entity that has a SlotManagerComponent.

I have found that it does work if the item is a new/modded prefab, not an overwritten or existing prefab.

Here is what I'm finding..

static TEF_CentralLootEconomyManager GetInstance()
{
	SCR_CentralEconomy centralEconomy = SCR_CentralEconomy.Cast(GetGame().FindEntity("SCR_CentralEconomy"));
	Print(centralEconomy);
	if(centralEconomy)
		return TEF_CentralLootEconomyManager.Cast(centralEconomy.FindComponent(TEF_CentralLootEconomyManager));
	else
		return null;
}

Which returns...

SCR_CentralEconomy centralEconomy = NULL

On entities outside of the layer that my SCR_CentralEconomy entity is within.

If you need anymore information, please let me know.

Thanks,
Fox

Details

Severity
Block
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
21H2
Category
General
Steps To Reproduce
  1. Setup entity with a SlotManagerComponent.
  2. Setup entity you want to find.
  3. In the SlotManagerComponent try and find the entity you want to find by down-casting with GetGame().FindEntity(). Print result.
  4. Compile and run and you should find that the entity returns NULL.

Event Timeline

Geez changed the task status from New to Assigned.Jun 9 2022, 12:50 PM