Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .yamato/training-int-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test_linux_training_int_{{ editor.version }}_{{ editor.extra_test }}:
eval "$($HOME/anaconda/bin/conda shell.bash hook)"
conda activate python3.10
python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
python -m pip install --upgrade setuptools
python -u -m ml-agents.tests.yamato.training_int_tests
dependencies:
- .yamato/standalone-build-test.yml#test_linux_standalone_{{ editor.version }}_{{ editor.extra_test }}
Expand Down
11 changes: 10 additions & 1 deletion Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,18 @@ void Awake()
};
}

int CreateNewSeed()
{
#if UNITY_6000_3_OR_NEWER
return gameObject.GetEntityId().GetHashCode();
#else
return gameObject.GetInstanceID();
#endif
}

void Start()
{
m_Random = new System.Random(RandomSeed == -1 ? gameObject.GetInstanceID() : RandomSeed);
m_Random = new System.Random(RandomSeed == -1 ? CreateNewSeed() : RandomSeed);
InitRandom();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Match3ExampleActuatorComponent : Match3ActuatorComponent
public override IActuator[] CreateActuators()
{
var board = GetComponent<Match3Board>();
var seed = RandomSeed == -1 ? gameObject.GetInstanceID() : RandomSeed + 1;
var seed = RandomSeed == -1 ? CreateNewSeed() : RandomSeed + 1;
return new IActuator[] { new Match3ExampleActuator(board, ForceHeuristic, ActuatorName, seed) };
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public bool ForceHeuristic
set => m_ForceHeuristic = value;
}

protected int CreateNewSeed()
{
#if UNITY_6000_3_OR_NEWER
return gameObject.GetEntityId().GetHashCode();
#else
return gameObject.GetInstanceID();
#endif
}

/// <inheritdoc/>
public override IActuator[] CreateActuators()
{
Expand All @@ -58,7 +67,7 @@ public override IActuator[] CreateActuators()
return Array.Empty<IActuator>();
}

var seed = m_RandomSeed == -1 ? gameObject.GetInstanceID() : m_RandomSeed + 1;
var seed = m_RandomSeed == -1 ? CreateNewSeed() : m_RandomSeed + 1;
return new IActuator[] { new Match3Actuator(board, m_ForceHeuristic, seed, m_ActuatorName) };
}

Expand Down