Skip to content
Discussion options

You must be logged in to vote

selector会要求提供一个UObject,而UE的一个游戏实例对应了一个GameInstance,所以你可以通过UObject拿到对应的GameInstance,然后GameInstance在启动的时候记录下自己的js的index。
还有一种做法就是利用GetWorld,然后直接使用WorldContext上的PIEInstance,不过这个可能只能在editor下使用(没试过runtime)
不过对于CDO类型的,会发现找不到对应的GameInstance,例如AnimNotify之类的,这种一般是要求覆盖GetWorld方法,例如在Notify的时候临时记录下当前的mesh之类的,使得通过cdo也能找到对应的world

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@yyj2013-two
Comment options

Answer selected by yyj2013-two
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@yyj2013-two
Comment options

@chexiongsheng
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants