Welcome to the Game Creator support forum!
This a place to ask questions, discuss ideas and report bugs. Please, provide your Unity and Game Creator versions as well as clear reproduction steps when opening a topic and full console logs.
Hi, I'm trying to make an infinite runner game, and need to use gravity to make the player fall down my "hill" but when I attach the player control component it won't react to gravity, how can I fix this?
Let's say I get rewards after doing a mission. These rewards would be added to my collection. I can navigate through my items in the menu, and choose what to sell, or what to bring on my next mission.
How can I do this?
This is an interesting case. What I would do is in the management scene, place all the items you've selected for your mission inside a Container object. In order to transfer the items to the next scene you need to edit the Container identifier (last field in the Container object where there's a bunch of numbers and letters) and replace it to something you can remember (such as "loadout").
Then, in your mission, you should have another empty Container but with the same ID ("loadout"). This will tell Game Creator that these two containers are the same and will be synched between scenes.
This approach should allow you to let the Player have an initial equipment, have your loadout carried over between missions and have a storage with the rest of the items (not available outside the management scene).
Greetings to everyone...
Since First time ( Game Creator ) installed in my project, and even after updating to version 1.0.3 and 1.0.4 I'm still getting all the errors shown in the image.... I also tried to install it in a new and empty project but still I'm getting the same errors even after clearing it from the console window.... I'm using the latest version of unity which is 2019.2.9f1.
Thanks in advance
Update: Unfortunately the bugs came from Unity it self... When I downgraded Unity from version 2019.2.9f1 to version 2019.2.8f1 , I don't see any errors at all.
Have a great day :)
Hello, first of all thanks for this awesome asset.
I'm trying to create a condition to activate an action after multiple objects are inside a trigger. I can get it to do the action with a single On trigger enter like a player walking in for example, but not sure how to go about doing the action only if player + other objects are in. Thanks!!
Hi Skaterlion, thanks for the kind words :-)
If I understood this correctly you want to execute a Trigger after a certain amount of objects enter the Trigger's collider. You can do this in two ways: either using a custom Trigger or using the current available ones. I'd go with the second one if you're not comfortable programming. Otherwise, the first one is faster.
You'll need to count how many objects enter a Trigger's surroundings. To do so, you'll need a Trigger On Enter and another Trigger On Exit on the same game object. Every time an object enters the Trigger it should increase a variable value by 1 and when an object exists, it should subtract 1.
So, you'll also need a Local Variable. Create a new Local Variable component and create a variable of type Number. Give it a name such as "counter" and set the initial value to zero.
For each of the Trigger from above, create an Action. The On Trigger Enter should call an Action that uses the Add Variable action, increasing the "counter" + 1. On the other hand, the On Trigger Exit should do the same, but subtracting 1 to the "counter" Local Variable.
Now, imagine you want to execute a list of Actions when the counter reaches 5. You can create a Conditions object on the On Trigger Enter from above (executed below the Action that increases the "counter" variable) and check if the "counter" variable is greater or equal than 5.
If it is, then you can do whatever you want to do when there are 5 or more objects.
Creating a custom Trigger that does this should be fairly straightforward. You'd just need to merge the two On Trigger Enter and On Trigger Exit and create a private variable that works as the counter.
Hope this helps!
I've tried call the Character Gesture Action to play the selected animation on the desired character in different methods(e.g. checked looptime in animation, restart the action, calling multiple times..and etc) but they always return back to the default idle/standing poses before the next animation. Is there a way to let it play seamlessly?
The Gesture action has "Wait Til Complete" checkbox. This allows the Action to be put on hold until the entire animation clip is completed. If you want start playing another Gesture right before the first one finishes, you could untick that checkbox and add a "Wait" action that waits the length of the first gesture minus 0.1 seconds, and play the second Gesture.
Bear in mind that Gestures don't take into account whether an animation is looped or not. If you want to play an animation that is looped (like sitting on a chair) you should be using a State. Check out the documentation for more information about these: https://docs.gamecreator.io/game-creator/game-creator/characters/states
This just happens with Instantiate from pool Action. It doesn't happen with Instantiate Action.
A weird behavior I found when using Instantiate from pool, was the prefab I'm instantiating gets toggled off the moment the first prefab is instantiated, but the clones work just fine. However, I have to make sure to enable the object in the prefab before running the game again. Image:
I also got some other errors and warnings. The NullReferenceException and Unexpected top level layout group popped out of nowhere.
The "Some objects were not cleaned up..." popped up after exiting play mode while using the Instantiate Action. This does not happen with Instantiate from pool.
Okay, step by step. The prefab being disabled is by design. I was hoping this would not be noticed, but seems it didn't go as planned :-P The reason why it disables the prefab is that, when instantiating the first instance, the pool automatically generates 50 instances (by default, but this can be changed) and disables them.
If the prefab wasn't disabled, the 50 instances would be active for a single frame, hence calling On Start Triggers and any other initialization methods attached. To solve this, we disable the prefab, creating disabled instances and postponing their initialization to whenever it is required.
On the other hand, creating instances of Characters using the pool system is not something we had contemplated. We'll open a ticket and have a look at it.
About the warnings, I wouldn't worry too much. When a character is instantiated using the Pool system it gets instantiated at position (0,0,0), which might not have a NavMesh nearby (hence the error). But this is not game breaking, since when the character is properly used, it should be teleported to a correct navmesh location.
These warnings are from Unity and there's little I can do about them. Just mind that they do not affect the gameplay experience.
I created a State asset and put it in Change Player State Action. Later I deleted the State asset, then changed the Change Player State Action to another Action. I pressed play, and got this error. Restarting Unity fixes this.
This error comes from Unity's codebase. Seems it didn't fully remove the reference, but restarting Unity flushes it and should work fine. Nothing will be broken afterwards.
I was trying to figure out why in some cases Floating text generates NullReferenceExeptions. This is what I found:
Simple scene as in screenshot ( two cubes with trigger on start and action floating text ).
If cube1 and cube2 are enabled - hit play – all is OK.
If cube1 is enabled and cube2 is disabled - hit play – enable cube2 – all is OK .
If cube1 and cube2 are disabled – hit play – enable cube1 or cube2 – NullReferenceExeption (screenshot and log below )
NullReferenceException: Object reference not set to an instance of an object
GameCreator.Messages.FloatingMessageManager+d__7.MoveNext () (at Assets/Plugins/GameCreator/Messages/FloatingMessage/Mono/FloatingMessageManager.cs:51)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
GameCreator.Messages.FloatingMessageManager:Show(String, Color, Transform, Vector3, Single) (at Assets/Plugins/GameCreator/Messages/FloatingMessage/Mono/FloatingMessageManager.cs:42)
GameCreator.Messages.d__7:MoveNext() (at Assets/Plugins/GameCreator/Messages/FloatingMessage/ActionFloatingMessage.cs:42)
GameCreator.Core.d__3:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IAction.cs:34)
GameCreator.Core.d__10:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:29)
GameCreator.Core.ActionCoroutine:.ctor(IEnumerator) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:24)
GameCreator.Core.d__9:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:109)
GameCreator.Core.IActionsList:Execute(GameObject, Action, Object) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:91)
GameCreator.Core.Actions:Execute(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Actions.cs:96)
GameCreator.Core.Trigger:Execute(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Trigger.cs:199)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject, Object) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:66)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:59)
GameCreator.Core.IgniterStart:Start() (at Assets/Plugins/GameCreator/Core/Mono/Igniters/IgniterStart.cs:16)
Same error is observed in a similar scene – one cube only with simple behavior ( task -> floating text ) – NullReferenceExeption. If you have in a scene a second object with floating text action, behavior does not generate error.
This is one of those esoteric issues that seem strange, but make sense once you know them. But first of all, the solution:
Game Creator needs a way to identify the primary camera. This is usually set up when using a Camera Motor, but since you don't have one in your scene you can do one of the following:
- Tag the Main Camera object with the MainCamera tag
- Add the Camera Controller component to the Main Camera
Either if them is fine. I'm posting below the explanation of why this is happening, just in case you're interested :-)
The thing is that the first time the Floating Message is set up, it creates a Canvas object and sets it to World Space. In order to appear in world space, it requires a reference to the camera that is going to be used for rendering the UI. And here was the problem: I assumed there's one that either has the "MainCamera" tag or has the HookCamera component (automatically added by the Camera Controller component).
I'l try to improve the message error so it gives you a better idea of what's missing. Thanks for the heads up!
I'm trying to do the following and I'm finding I need so many actions and conditions:
- Clear dirt patch
- Get plant seed (picking one up from a set lying on the ground)
- Plant seed
- Water seed
- After some time, plant finishes growing
- Harvest crop
The reason it's so difficult is because I have multiple plants. What I'm doing right now is when I 'Get plant seed', I store a variable for what seed I have. Then when I plant, I check that variable. Depending on what seed I have, I perform a set of actions, which generally consists of 'Set Active a prefab on the dirt patch to represent first stage of crop growth' and 'Set a state to a local variable'. So if I have 8 different possible seeds I can plant, I'd need 8 different sets of actions. I'd also need 8 conditions saying 'If it's ____ seed', do '____ seed's Action'. Also, each time I interact with the dirt patch, I have to check what state it's in. Depending on the state (dry, watered, dead), I'd have to perform a different set of actions. This quickly gets very cumbersome.
Agree, but there are some things you can do to "share" code (Actions in this case) between different plans. Let's say you have a Fire Plant that takes 5 seconds to grow and gives you 3 Fire Seeds. Then, you also have a Water Plant that takes 10 seconds to grow and gives you 1 Water Seed.
You could have a bunch of Global Variables of type Game Object that reference the prefab objects of each plant. For example, global variable "fire-plant" would reference a Fire Plant prefab, and "water-plant" would reference a Water Plant prefab.
Now this is very useful because when you plant a plant, you simply instantiate a game object from the variable you want. You can have an "On Start" Trigger in each plant that will execute an Actions that waits a few seconds (5 for Fire Plant and 10 for Water Plant) and changes the 3D model onto one that looks like a fully blossomed plant.
You could also add a Local Variable "is-dead" to all plants as well as a "water-need" variable, that starts at different values depending on the seed. An "On Start" Trigger could start lowering the "water-need" at fixed timesteps, and if the value reaches 0, it changes the value of "is-dead" to true. Watering a plant would simply increase the "water-need" numeric variable.
The idea would be having each seed/plant as an individual prefab and everything work very systemic-wise. Moreover, you could also make use of the "Execute Actions" action, which allows you to execute an Actions component from a game object (that can come from a Local Variable).
If you have a particular thing you want to have explained, feel free to ask. This looks like a very interesting project
Any way to set the volume for an individual sound via the Play sound action? i may have a few different sounds in the scene, and would like them at different volumes. Using the Play Sound doesn't allow for a volume modifier. any suggestions?
or anyway to execute a AudioSource to the Play Sound via the audio manager?
Hi Alienmadness. The Play Sound, as you mention, doesn't allow to change the volume of that particular sound. This should be ideally done in an external program and import the sound effect with the correct volume. The reason being that we have a separate volume layer for different kind of audios:
- Sound Effects
- Voices (coming soon)
However, if you still want to play a sound and modify its volume from Unity, as you said, you can do that interacting with the AudioSource component. You just need to enable the "Play On Awake" option in that component. To play this AudioSource component, disable and enable it using the "Set Active" action.
Hope this helps! Happy game making!
Customer support service by UserEcho