NEW! Creator Kit: Beginner Code

Download gives errors and doesnt run

The screenshots only show warnings, those shouldnā€™t stop the project from working (but thanks for reporting them, we should try to remove those in the next release).

If you press play in the state the editor is in that screenshot, nothing will happen as the scene is empty. The 1st tutorial will guide you to open the right scene to test the game (part 7 here : https://learn.unity.com/tutorial/get-started-with-creator-kit-beginner-code?projectId=5d48025dedbc2a0020e85be2#5d4c222fedbc2a00219044fa )

1 Like

Gamepad support would be awesome with this.

Iā€™m trying to find out how ā€œAttackEventā€ and ā€œFootstepEventā€ in AnimationControllerDispatcher. I tried adding my own enemy, but it does not get these triggeredā€¦ I have been checking it up and down to match the game object or if itā€™s in the animation controller, simply canā€™t find references for ā€œFootstepā€ anywere. Please help :slight_smile:

Oh whoops, I found it by using Total Commander search, itā€™s baked into the animation :slight_smile:

Example from: CactusBossy_Walk

4958798--482276--upload_2019-9-12_22-52-5.png

I really liked it, but i want to enlarge the map. i tried to remove some grass and paint the sand on it but i canā€™t walk there?
How can i walk on that terrain?

Hey there. So Iā€™m totally new to this and trying to get through this kit. Iā€™ve encountered an issue Iā€™m having a heck of a time resolving.

In part 10, the create parameters for the constructor portion, step 4 says to go change

LootAngle myLootAngle = new LootAngle();

to

LootAngle myLootAngle = new LootAngle(15);

Then immediately on part 11 it seems to indicate changing that to

LootAngle spawnAngle = new LootAngle(45);

Is that what itā€™s saying to, or am I supposed to be adding this in addition to the existing one?

Here is what my start function looks like based on the steps in the tutorial.

void Start();
LootAngle myLootAngle = new LootAngle(15);

LootAngle spawnAngle = new LootAngle(45);

//every call will advance the angle!
potionSpawn(spawnAngle.NextAngle());
potionSpawn(spawnAngle.NextAngle());
potionSpawn(spawnAngle.NextAngle());
potionSpawn(spawnAngle.NextAngle());

It feels wrong and has several errors I donā€™t quite understand. Any insight would be great.

Personally, at the end of this part it would be nice to see the full script as it should look so I know where I made my mistakes.

Thanks!

1 Like

Discovered my problem! The wording of one of the steps seemed to have me put the following outside of the SpawnerSample class.

void SpawnPotion(int angle)
{
int radius = 5;

Vector3 direction = Quaternion.Euler(0, angle, 0) * Vector3.right;
Vector3 spawnPosition = transform.position + direction * radius;
Instantiate(ObjectToSpawn, spawnPosition, Quaternion.identity);
}

Move it move it into the class below the Start function and everything was better!

Thanks!

1 Like

Iā€™m working on expanding this using resources from Synty Studiosā€™ Western and Western Frontier Packs, and animations from Explosiveā€™s RPG Character Animation Pack.

As someone noted above, the Attack animation that is built in to the Tutorial uses an Animation Event to indicate when a hit has occurred, and this calls CharacterControl.AttackFrame().AttackFrame does several things, but probably the most important is that it sets the playerā€™s stateback to Default. So without this, the CharacterControl.CheckAttack() function thinks weā€™re still attacking, so the player can never attack after the first one!

To deal with this, we can add an Animation Event called AttackEvent to our animations, BUTthe RPG Pack actually comes to our rescue because EVERY attack has a Hit() Animation Event built in ANDtimed correctly!

So I just created a Hit() function here, and then copied the body of the AttackEvent() function!

The Run animation that the Tutorial uses also relies on an Animation Event to kick up dust as you run along, but AGAIN the RPG Animation pack saves our bacon, with the FootL() and FootR() functions.This is actually arguably better, since you can (if you want) explicitly determine which foot is hitting the ground and exactly when! I didnā€™t do anything weird with the different feet here. I just copiedand pasted the body of FootstepEvent() into FootR() and FootL() functions, and it now correctly kicks up dust for my cowgirl!

NEAT!

So now a question: the SeethroughBlue shader has some really funky effects when applied to the Synty character models, most likely because there are some occluded triangles within the mesh, which causes the shader to kick in even when the character is standing out in the open. Is there any way to deal with that, or am I just more or less stuck with disabling it? Itā€™s such a NICE effect, but it looks terrible if the model isnā€™t optimized.

Iā€™ve also gotten a pistol to work nicely, but so far have not found a way to quickly switch weapons in game. Iā€™m controlling my animations using a WeaponID parameter, which I suppose I should bake into the Weapon stats Scriptable Object, and add to a script, but I havenā€™t worked that out yet (at present I switch it manually in the Editor).

This is a REALLY good kit, with lots of great systems built in. I switched out the Mike Moose model for a cowgirl from the Western pack, and was pleasantly surprised when she appeared in my Inventory screen without me having to figure out how that was done!

Oh, if youā€™re going to switch out the main character for one of your own, youā€™ll need to do a few things:

  • Create an Animator Controller, since Mike Mooseā€™s animations are specific to him. You can (and probably should!) copy his Animator Controller, and just swap out the animations, though.
  • Copy every component from the Character object in the Example Scene onto an empty game object (mineā€™s called Character_Player_Cowgirl)
  • Make your character model the child of that empty game object
  • Remember to assign an Animation Controller Dispatcher to your character model!
  • Create an empty game object thatā€™s a child of Character_Player_Cowgirl (or whatever you call yours) and rename it to CameraTarget
  • Update GameplayVCAM (a Cinemachine Virtual Camera) to Follow and Lookat the new Camera Target object
  • Update Managers->SFX Manager to make the Listener Target your new Camera Target
  • Update Managers->UIRoot->GameUI to set the Character_Player_Cowgirl to be the new Player Character

There may be more, but so far everything is humming along swimmingly.

This thing is a lot of fun!! :slight_smile:

1 Like

Just calling AttackEvent() from inside your new Hit function should work the same and will allow you to have a single place (the AttackEvent function) to modify if you want to do modification to what happen on attack. Same for footstep event.

The seethrough need to be rendered before the character. Normally thatā€™s the shader would do 2 rendering pass, the see through first, but shader graph donā€™t allow yet to do multi pass, so we have to rely on the renderer drawing meshes multiple time if it have more material than mesh. But that mean we need to order them properly.

If you look at the see through material, you will see that itā€™s rendering queue is set to 2098 (Geometry+98), that is set through the shader, and if you look at MikeMoose material you will see itā€™s queue is 2099 (Geometry+99) so that itā€™s draw AFTER the see through one. Since the see through does not write into depth, the character rendering will ā€œoverwriteā€ any blue it render on top of.

So make sure all your new character materials have that same queue set (can be set per material, donā€™t have to write a special shader for it).

Indeed, just add it to the Scriptableobject (you can even make it an enum WeaponStyle, like

public enum WeaponStyle
{
    Melee = 0,
    Pistol = 1
}

public WeaponStyle Style;

then Style will appear on in the weapon data inspector as a dropdown with a proper name, and you can send that as a parameter to your animator to choose the right blend tree (or even just switch between 2 animator controller if you use totally different animation for all stage) by casting in (int)Style to make it back into an integer id.

In a full game, I would even recomend using animation blending (so you can have a single leg animation for running, idle etcā€¦) and just blend top body animation based on equiped weapon but that require a lot more change and we didnā€™t have the animation for it, but thatā€™s a good ā€œleft as an exercise to the readerā€ :stuck_out_tongue:

Just calling AttackEvent() from inside your new Hit function should work the same and will allow you to have a single place (the AttackEvent function) to modify

Oh, thatā€™s brilliant! Gah! Why donā€™t I think of these things??

So make sure all your new character materials have that same queue set (can be set per material, donā€™t have to write a special shader for it).

Hmmā€¦ Iā€™m using the LWRP Lit Shader, and that doesnā€™t appear to be one of the exposed settings (I am shader illiterate, so pardon me if Iā€™m not using the right words here). I tried switching to the same shader that Mike uses (ShaderGraph/MainRimShaderGraph) and that does kind of work, but I did still get weird blue artifacts when the character is facing away from the camera. Then I realized that there was a setting called Rim Color in that shader, and setting that to black (and the Render Queue to 2099) seems to have resolved my issue!

Indeed, just add it to the Scriptableobject

Brilliant! Iā€™ll let you know how it goes!

I think I found a typo. In CharacterData the Comment says ā€œAgility reduce by 0.5% the cooldown to attack (e.g. if agility = 50, 25% faster to attack)ā€

The code says:

If you take a weapon with a speed of 1, and use the example agility of 50, this results in a new modified cooldown of 0.975.

I think thereā€™s just an extra zero in the second float. If we change that to 0.01f, the new modified cooldown (of a speed of 1 and an agility of 50) is 0.75, which is a 25% reduction, and matches the Comment.

As pointed out in the comments section in the tutorial, you canā€™t save the project by pressing Ctrl + S, or from File > Save Asā€¦ Ctrl + S will save the scene, not the project. There should be a File > Save Project Asā€¦, but there isnā€™t. The only way to save your own copy of the project is by quitting the editor and then selecting Keep.

This is very frustrating until you discover this. Like probably many other newcomers I spent quite some time until I discovered how to save my own copy of the project. Until you fix this is in the Unity editor, at least update the tutorial instructions which should be quick workaround.

Hi guys I am trying this days to use creator kit beginner code to make my character move attack and collect. At the beginning everything works fine until a few seconds later he starts to walk in the direction I want but facing the wrong way so he looks like he is sliding and everything starts to be a mess.Did anyone manage to make it work? Does it has anything to do with me using a plane as an example and not a terrain? Because even when I use mikeā€™s avatar and animations to my character even if it isnā€™t animating everything is working good and he is walking correctly but not when I use my avatar and animations for some reason.

Iā€™m pretty sure this is a problem with the lightweight render pipeline. Probably incompatibility with your OS or graphics driver. Facing the same problems using Ubuntu.

Changing terrain material doesnā€™t fix it for me. Had to disable lightweight pipeline (remove pipeline asset from Project Settings > Graphics) and assign the default terrain material to the terrain object. Sadly you have to reconfigure all materials to use Standard shader, as the shaders used seem to be incompatible with default pipeline. Have no solution for the outlines yet, and havenā€™t checked if all particles are compatible with standard particle shader.
Hard grind to get it working, of course look (and performance) differs a lot from intended version.
I hope the pipeline getā€™s fixed for ā€œnot windows usersā€ :slight_smile:

edit: havenā€™t tried to fix the pipeline itself yet, maybe i will try that too

I was able to get it to work just fine using some low poly cowboy models from Synty, and the RPG Animation set from Explosive. I didnā€™t change the terrain, though, for my experiments, but I canā€™t think of how changing it to a plane would affect anything (assuming that the Navigation got baked for the plane, which it would have to since the player moves with a NavMeshAgent).

I didnā€™t have any problems seeing the terrain in the game (or with it being rotated).

After playing with it for a few days, I dropped this, but I did manage to implement shooting for both the player and the enemies. I got stuck when I tried to fiddle with the inventory, because I couldnā€™t figure out how to let the player choose between various weapons (by default, your regular weapon is replaced when you pick up a new one, and you canā€™t drop the one you have).

Still, I found the framework to be pretty flexible to a point.

I am making a game where you use abilities and new weapons but their use is time based so you have to use wisely your new weapons with better stats or the abilities or you will wait for the cooldown in order to collect a power up card to use so maybe you will find a way with a script and a philosophy of yours to make it to work since you do not have a way to discard by the kit.
One more question I downloaded the rpg animation pack what changes should I make to use the animations? Because I want to use a generic character to play generic animations instead of humanoid , like the character in the kit.

First, Iā€™m using a humanoid rig. This makes retargeting animations work.

Generic animations are typically used for a specific model, so you canā€™t retarget them to a different model (unless they happen to have the exact same skeleton and rig).

Rig a humanoid character, copy the existing controller, and replace the animations with those from the rpg animation pack.

If I were you, Iā€™d start with one of the simpler packs to learn the basics of character movement and controls (thereā€™s one where you make a stealth game about a cat in a house that will get you up to speed).

Hello Professionals,
I started the Creator Kit: Beginner Code course after experimenting with unity software and got stuck in the last ā€œcustomizationā€ class.

One of the tasks I was tasked with was to remove one unit from the inventory when the bool true was used.
And in the second task of this task if the playerā€™s life is full the potion will not be used and no bool false will be removed.

What should I think of when writing variables and classes?

Nice tutorial, can you please give a example how you would add more ā€œadvancedā€ status effects? For example some ideas what I mean:

  • Damage Shield is added with a start value and everytime the character takes damage it reduces the damage until the shield is at zero and is removed or the duration is done
  • Damage Spikes, everytime the character takes damage a part of the damage is returned to the attacker until the duration is done

My current idea would be to extend the StatSystem Damage method and add some events there for example OnDamage event and OnPostDamage event and pass the attack data as event args (similar to the weapon effects, but as events instead of direct method calls, so ā€œanyā€ object can modify/observe the damage).

Then the status effects (or any other object, for example a quest system which wants to keep track of damage dealt or enemy killed etc) could add event handler and modify/observe the damage.

This this a valid/good solution or would you recommend a different solution for status effects which want to modify the damage?