|
Post by jheinen on Dec 6, 2020 10:47:42 GMT
Hi,
iam trying to setup cinematics at runtime, because my level is randomly generated and i need to be as flexible as possible.
Once the level is loaded i start to setup the cinematics like this.
public void Setup()
{
cinematics = GameManager.instance.proCameraScript.gameObject.AddComponent<ProCamera2DCinematics>();
foreach (var transform in listOf_cinematicTargets)
{
cinematics.AddCinematicTarget(transform,easeInDuration,-1);
}
cinematics.OnCinematicFinished.AddListener(ResetPlayerControls);
} The problem is, that iam getting an Null reference exception when doing this. At this line:
cinematics.OnCinematicFinished.AddListener(ResetPlayerControls);
While ive checked the cinematics object and its filled. Its the OnCinematicFinished Event which is not accessible UNTIL i manually add a Listener in the inspector and remove it. Then my AddListener works.
Can you take a look into, why this is happening?
Thank you
|
|
|
Post by Luís Pedro Fonseca on Dec 6, 2020 19:21:13 GMT
|
|
|
Post by jheinen on Dec 8, 2020 16:54:47 GMT
Worked. Thank you
|
|