Jump to content
  • Advertisement
Sign in to follow this  
Pedro Alves

change umg unreal engine by c++

This topic is 510 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how i change umg for another by widget when i click in button  using c++
i using this tutorial to make my login systyem


but i can´t put work
void ULoginMenuWidget::OnOptionsClicked()
{

	/*if (GetWorld()->GetGameInstance())
	{
		UStateManager *StateManager = Cast<UStateManager>(GetWorld()->GetGameInstance()); 
		if (StateManager) 
		{ StateManager->ChangeState(EGameState::EOptionsScreen);
		}
	}
	*/
	if (GEngine) {
		GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::MakeRandomColor(), TEXT("Options"));
	}
	/**/
	
}
my game crash

Share this post


Link to post
Share on other sites
Advertisement

now i have other problem

when i try login the game and exit and try make login for the secound time the game crash
give this error
what i doing wrong
and this is the link to my project
https://www.dropbox.com/sh/ay42hi5u7npwf8n/AAB0lDrJ6VjKQ2pVL4wcCP8Sa?dl=0
Access violation - code c0000005 (first/second chance not available)

UE4Editor_CoreUObject
UE4Editor_RPG_4849!UGameSparksStatics::LoginSucessDetails_Response() [c:\users\pedro\documents\unreal projects\rpg\source\rpg\gamesparksstatics.cpp:48]
UE4Editor_RPG_4849!GameSparks::Core::GSTypedRequest<GameSparks::Api::Requests::AccountDetailsRequest,GameSparks::Api::Responses::AccountDetailsResponse>::Callbacks::OnSucess() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\include\gamesparks\gstypedrequest.h:113]
UE4Editor_GameSparks!GameSparks::Core::GSRequest::Complete() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gsrequest.cpp:83]
UE4Editor_GameSparks!GameSparks::Core::GS::ProcessReceivedResponse() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:510]
UE4Editor_GameSparks!GameSparks::Core::GS::ProcessReceivedItem() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:565]
UE4Editor_GameSparks!GameSparks::Core::GS::OnMessageReceived() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:164]
UE4Editor_GameSparks!GameSparks::Core::GSConnection::OnWebSocketCallback() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gsconnection.cpp:129]
UE4Editor_GameSparks!`anonymous namespace'::_RealWebSocket::_dispatch() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\easywsclient\easywsclient.cpp:649]
UE4Editor_GameSparks!GameSparks::Core::GSConnection::Update() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gsconnection.cpp:160]
UE4Editor_GameSparks!GameSparks::Core::GS::UpdateConnections() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparksbasesdk\src\gamesparks\gs.cpp:314]
UE4Editor_GameSparks!UGameSparksModule::Tick() [c:\users\pedro\documents\unreal projects\rpg\plugins\gamesparks\source\gamesparks\private\gamesparksmodule.cpp:66]
UE4Editor_Engine
UE4Editor_UnrealEd
UE4Editor_UnrealEd
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

Share this post


Link to post
Share on other sites

Access violation - code c0000005

This generally means you're attempting to read and/or write to memory which is invalid.

Check if pointers are null before using them. Additionally, check if you're reading/writing outside the bounds of an array (keep in mind that for an array of size 5, the last valid index is 4).

Share this post


Link to post
Share on other sites

The problem is only happen when i try login for the secound time

i think the problem is in this function

void UGameSparksStatics::LoginSucessDetails_Response(GameSparks::Core::GS & gs, const GameSparks::Api::Responses::AccountDetailsResponse & resp)
{
    if (inicialized) {
        if (!resp.GetHasErrors()) {

            /***********************************************************************/
            if (theWorld->GetGameInstance())
            {
                UStateManager *manager = Cast<UStateManager>(theWorld->GetGameInstance());
                if (manager)
                {
                    manager->ChangeState(EGameState::EServerScreen);
                }


            }
/****************************************************************************************/
            else
            {
                if (GEngine) {
                    GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::MakeRandomColor(), TEXT("Accounts Details Request Fail"));
                }
            }

        }


    }
}

becouse i call a fuction like this the gameengine never crash

i think the gameparks don´t like when have change the gamestats

void UGameSparksStatics::LoginSucessDetails_Response(GameSparks::Core::GS & gs, const GameSparks::Api::Responses::AccountDetailsResponse & resp)
{
    if (inicialized) {
        if (!resp.GetHasErrors()) {
            if (GEngine) {
            GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::MakeRandomColor(),resp.GetJSONString().c_str());

            }
            else
            {
                if (GEngine) {
                    GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::MakeRandomColor(), TEXT("Accounts Details Request Fail"));
                }
            }

        }


    }
}
Edited by Landi20

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!