Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to brain script through other script #1720

Closed
MrGitGo opened this issue Feb 17, 2019 · 5 comments
Closed

Access to brain script through other script #1720

MrGitGo opened this issue Feb 17, 2019 · 5 comments
Assignees
Labels
help-wanted Issue contains request for help or information.

Comments

@MrGitGo
Copy link

MrGitGo commented Feb 17, 2019

I have a GameManager script and I wanted to change the graph model while the game is running through script:

public GameObject brain;

void function(){
    brain.GetComponent<????>()
}

And here I noticed that I can't have access to the script like this. Do you know how to do this? And would I get problems if I change the Graph model while the game is running? My intention is to increase the degree of difficulty of the game.

@awjuliani awjuliani self-assigned this Feb 18, 2019
@awjuliani awjuliani added the help-wanted Issue contains request for help or information. label Feb 18, 2019
@awjuliani
Copy link
Contributor

Hi @semih67

This is an interesting use-case, and it should definitely be possible. What version of ML-Agents are you using? As of v0.6, Brains are not gameobjects, but rather scriptable objects. You will want to access the learning-brain you are using, and grab the model variable to change it.

@MrGitGo
Copy link
Author

MrGitGo commented Mar 9, 2019

I know this is a little bit late but could write the code line of how I can access the scriptable object? @awjuliani

@awjuliani
Copy link
Contributor

Hi @semih67

Here is the line where the model is defined: https://github.com/Unity-Technologies/ml-agents/blob/master/UnitySDK/Assets/ML-Agents/Scripts/LearningBrain.cs#L42. It is publicly accessible, so you should be able to set it from another script.

@eshvk
Copy link
Contributor

eshvk commented Apr 16, 2019

Hi @MrGitGo, I am going to close this issue for now due to inactivity. Hopefully you were able to resolve your issue. Please feel free to reopen if you still have issues.

@eshvk eshvk closed this as completed Apr 16, 2019
@lock
Copy link

lock bot commented Apr 15, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help-wanted Issue contains request for help or information.
Projects
None yet
Development

No branches or pull requests

3 participants