Download

Game Instance or Global Data Access for Game Manager? and the camera...

only 22 hour left until the deadline from my producer.

I have extremely urgent matters…

  1. I followed Rama’s code A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

It sounds working for now…

I face new challenge as this "What if I have carry datas (such as current Player Party Members’s stat like… HP) that constantly are changing, but must be persistent? "

Then I found Game Instance - A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

oops… For sensitive yet various datas, should I use custom Game Instance? if I use Game Instance, where should I use Global Data Access?

  1. Camera… It is newbie question again… :frowning: but I also need help from it.

I think I will place a scene’s own camera in each scene.

is it okay? or should I implement the camera inside the GameManager c++ (whether it is Game Instance or Global Data Access)?

3.And lastly… How do I set my camera as default when I hit Play Button?

Even in Empty Level, new Camera kept is being instanced… which I don’t really need it for now.

Again… another beginner question and may not relate to C++, but I really need help again…

If I have free time, I will figure out without asking questions… but I am really desperate and have no aid from my entourages about Unreal Programming c++.

(their forte is mostly Unity, not Unreal. Not enough Programmers too, Awkward to be Unreal Engine Beginner by myself in South Korea).

Anyway… please T.T

Sure, inherit from GameInstance and put whatever you want to persist in it, including a global data pointer. You can probably modify it to persist duplicated PlayerStates across levels even (if you are using AIController::bWantsPlayerState)

thx. but does that includes default Instance camera too?

Hi !

What do you mean by default instance camera ? What do want to achieve ?

wow thx. Sorry about ambiguous description. I just want to put my own camera object with orthographic setting, not new camera when i hit play button.

Ok :slight_smile:

Question #1 : If you need to store data like HP, Mana or whatever specific to one player, use PlayerState and make it persistant through server travel (solution here : Transfer PlayerState data during seamless travel - UE4 AnswerHub).

Question #2 : If your camera can move in your scene and you want to store their positions, that can be reset if you change level, I think you can create a TMap who store an id to your camera as key, and value will be a FTransform, and I guess you will need to create a new Camera actor, with a “Event Begin Play” who load data and “Event End Play” who save data, and you can add an ID integer to identify your camera in the TMap, lastly add some function C++ to manage TMap from blueprint.

Question #3 : I don’t know if they are a simple configuration to do that, but you can edit the Level blueprint and use “Event Begin Play” to get the player controller and use the node “Set View Target” to set your camera.

I hope this help you ! :slight_smile:

holy cow! Man, I think your solution might work on my project. i gonna try them. Thank you so much! You provided me with a lead like a clue in a detective’s case

about 1, even though it is single player. is using PlayerState okay?

Oh it’s single player game, well yes GameInstance do the trick :slight_smile:

thank you for quick reply. you saved me.